打包应用程序时出现Grails 3错误-无法解析配置':gspCompile'的所有依赖项
应用信息:
- Grails版本:3.1.8
- Groovy版本:2.4.6
- JVM版本: 1.8.0_60
- Grails Version: 3.1.8
- Groovy Version: 2.4.6
- JVM Version: 1.8.0_60
我正在运行grails package
以获取可运行的存档,但是遇到以下错误:
I'm running grails package
to get runnable archives however I come across the following error:
无法解析配置':gspCompile'的所有依赖项. 无法解析javax.servlet:javax.servlet-api:3.1.0. 要求者: app:app:0.1 无法解析javax.servlet:javax.servlet-api:3.1.0. 无法获取资源' https://repo.grails.org/grails/core/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.pom " . 无法HEAD' https://repo.grails.org/grails/core/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.pom ". 连接到repo.grails.org:443 [repo.grails.org/52.205.225.191,repo.grails.org/23.23.24.228]失败:连接超时:连接
Could not resolve all dependencies for configuration ':gspCompile'. Could not resolve javax.servlet:javax.servlet-api:3.1.0. Required by: app:app:0.1 Could not resolve javax.servlet:javax.servlet-api:3.1.0. Could not get resource 'https://repo.grails.org/grails/core/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.pom'. Could not HEAD 'https://repo.grails.org/grails/core/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.pom'. Connect to repo.grails.org:443 [repo.grails.org/52.205.225.191, repo.grails.org/23.23.24.228] failed: Connection timed out: connect
Error Command [package] error: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.13-bin.zip'.
servlet api实际上在grails仓库中(感谢Loucher),所以我不完全确定为什么会出现此错误.
The servlet api is in fact in the grails repo (thanks to Loucher) so I'm not entirely sure why I'm gettin this error.
After doing some research I have found out that Grails 3 should use Gradle 2.2 or higher and I was using version 2.1.3. After changing my gradle version to 2.3 the error seems to have disappeared however I had not got my runnable archives due to other errors. The error I was getting was the following:
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(Ljava/util/List;Lgroovy/lang/Closure;)Ljava/util/List;
搜索此错误后,我遇到了一个错误在grails中.更多搜索使我转向这篇文章.我使用以下命令按照注释中的建议将Gradle版本更新为2.9:
After searching this error I had encountered I found out there is a bug in grails. More searching lead me to this post. I updated my Gradle version to 2.9 as suggested in the comments using the command below:
./gradlew wrapper --gradle-version 2.9
然后我使用gradle生成了战争文件,幸运的是,它似乎已经完成了.
I then used gradle to generate the war file and thankfully that seemed to have done it.