Could not download spring-boot-autoconfigure.jar (org.springframework.boot: spring-boot-autoconfigur

我在家创建了一个grails工程运行grails run-app,出现如下错误:

D:\Projects\Grails\project\HelloWorld>grails run-app
Java HotSpot(TM) Client VM warning: TieredCompilation is disabled in this releas
e.
> Configuring > 0/1 projects > root project > Resolving dependencies ':classpath
1/1 projects > Resolving dependencies ':agent' > Resolving dependencies 'detache
 > Resolving dependencies ':runtime' > Resolving dependencies 'detachedConfigura


FAILURE: Build failed with an exception.


* What went wrong:
A problem occurred configuring root project 'HelloWorld'.
> Could not resolve all dependencies for configuration ':runtime'.
   > Could not download spring-boot-autoconfigure.jar (org.springframework.boot:
spring-boot-autoconfigure:1.3.3.RELEASE)
      > Could not get resource 'https://repo.grails.org/grails/core/org/springfr
amework/boot/spring-boot-autoconfigure/1.3.3.RELEASE/spring-boot-autoconfigure-1
.3.3.RELEASE.jar'.
         > Could not GET 'https://repo.grails.org/grails/core/org/springframewor
k/boot/spring-boot-autoconfigure/1.3.3.RELEASE/spring-boot-autoconfigure-1.3.3.R
ELEASE.jar'.
            > 这是在主机名解析时通常出现的暂时错误,它意味着本地服务器没有从权威
服务器上收到响应。


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.


BUILD FAILED


Total time: 48.497 secs
| Error Error initializing classpath: 这是在主机名解析时通常出现的暂时错误,它意
味着本地服务器没有从权威服务器上收到响应。 (Use --stacktrace to see the full tra
ce)


D:\Projects\Grails\project\HelloWorld>

-------------------------------------------------------------------------------------------------------

同样的操作,我在公司操作一切正常,可能是因为我家里的网络太差了。。。

错误原因:

grails在运行我们的工程时,发现工程依赖的jar包,系统中没有,所以就自动帮我们去下载了,悲催的是竟然下载失败。。。

解决方法1:

打开工程根目录下面的文件:build.gradle,然后将里面的两个网址:

maven { url "https://repo.grails.org/grails/core" }

都改成:maven { url "http://repo.grails.org/grails/core" }      //   即去掉s,这样就可以下载了

------------------------------------------------------------------------------------------------------------------------------------

解决方法2:

我发现grails运行命令grails run-app下载的jar文件包保存在以下位置:

C:\Users\Administrator\.gradle\caches\modules-2\files-2.1

所以到其它正常的电脑拷贝该目录中的文件到不正常的电脑同一目录下面即可。

为了保险,我建议还是拷贝整个.gradle目录吧:  C:\Users\Administrator\.gradle









你可能感兴趣的:(Grails)