Grails 3 error when packaging aplication- Could no

2019-09-08 04:33发布

App Info:

  • Grails Version: 3.1.8
  • Groovy Version: 2.4.6
  • JVM Version: 1.8.0_60

I'm running grails package to get runnable archives however I come across the following error:

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'.

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.

1条回答
不美不萌又怎样
2楼-- · 2019-09-08 05:09

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;

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

I then used gradle to generate the war file and thankfully that seemed to have done it.

查看更多
登录 后发表回答