Mac上安装Grails3.0

最近在复习Grails,2013年用的2.2,已经熟练的。两年了,发现有3.0了。本以为按照2.0的套路(解压后就可以用)就可以安装使用,但折腾了两天也没弄好,莫非Windows XP装不了?

先不管了,在Mac下安装试试。

Mac上安装Grails3.0_第1张图片

【1】Mac上需要先安装JDK,安装后自动会添加JAVA_HOME

【2】参照上图,安装gvm

【3】基于gvm,安装grails
ibeartekiMacBook-Pro:testgrails ibear$ gvm install grails
==== BROADCAST =================================================================
* 16/07/15: Groovy 2.4.4 has been released on GVM. #groovylang
* 10/07/15: Springboot 1.3.0.M2 has been released on GVM. #springboot
* 09/07/15: Grails 3.0.3 has been released on GVM. #grailsfw
================================================================================

Downloading: grails 3.0.3

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0   392    0     0    113      0 --:--:--  0:00:03 --:--:--   264
  0  149M    0  646k    0     0  29193      0  1:29:12  0:00:22  1:28:50 59434


装到一半,下载不动了,连国外的网总是不稳定。
也可以手工下载grails-3.0.3.zip,然后放到/User/myuser/.gvm/archives下面
然后再执行安装,它就会以为已经下载好了。

0curl: (7) Failed to connect to s3.amazonaws.com port 443: Operation timed out
unzip:  cannot find zipfile directory in one of /Users/ibear/.gvm/archives/grails-3.0.3.zip or
        /Users/ibear/.gvm/archives/grails-3.0.3.zip.zip, and cannot find /Users/ibear/.gvm/archives/grails-3.0.3.zip.ZIP, period.

Stop! The archive was corrupt and has been removed! Please try installing again.

ibeartekiMacBook-Pro:~ ibear$ gvm install grails

Found a previously downloaded grails 3.0.3 archive. Not downloading it again...

Installing: grails 3.0.3
Done installing!

Do you want grails 3.0.3 to be set as default? (Y/n): Y

Setting grails 3.0.3 as default.


【4】试着创建一个项目
grails create-app test
cd test

grails --此时会报错,因为没有安装gradle

【5】基于gvm安装gradle
gvm install gradle

【6】重试第4步
(第一次会出现漫长下载,以后就不需要了, 这些文件都存在了~/.gradle/caches里)
ibeartekiMacBook-Pro:test ibear$ grails
Download https://repo.grails.org/grails/core/org/grails/grails-gradle-plugin/3.0.3/grails-gradle-plugin-3.0.3.pom
Download https://repo.grails.org/grails/core/com/bertramlabs/plugins/asset-pipeline-gradle/2.1.1/asset-pipeline-gradle-2.1.1.pom
Download https://repo.grails.org/grails/core/io/spring/gradle/dependency-management-plugin/0.5.2.RELEASE/dependency-management-plugin-0.5.2.RELEASE.pom
Download https://repo.grails.org/grails/core/org/codehaus/groovy/groovy/2.4.3/groovy-2.4.3.pom
Download https://repo.grails.org/grails/core/org/slf4j/slf4j-api/1.7.10/slf4j-api-1.7.10.pom
Download https://repo.grails.org/grails/core/org/slf4j/slf4j-parent/1.7.10/slf4j-parent-1.7.10.pom


经过漫长等待,终于出现了久违的提示符
grails> run-app
| Running application…


Mac上安装Grails3.0_第2张图片


【总结】
1. 现在好多构建工具都是online模式的,很多依赖关系都自动去网上下载,但国内外的网不好,有时会有问题。
2. Grails的安装文档里没有提需要安装Gradle(症结),这个有点坑。。。

你可能感兴趣的:(grails)