I'm trying to run a legacy system (using Grails 2.3.7 and JDK 7) for development locally which until now has worked as usual.
I was getting another error that I solved deleting the folders .m2
and .grails
in my home. After that, it seems maven isn't able to download the dependencies:
Error |
Resolve error obtaining dependencies: Failed to read artifact descriptor for org.grails.plugins:tomcat:zip:7.0.52.1
Error |
Resolve error obtaining dependencies: Failed to read artifact descriptor for org.grails.plugins:scaffolding:zip:2.0.2
Caused by: org.apache.http.client.HttpResponseException: Permanent Redirect (308)
Full log here.
Probably I'm missing something but the plugin can be reached from repo.grails.org repository.
How do I get around this problem?.
For the time being, I partially solved the error by copying my coworkers .m2
and .grails
folder but when I change some dependency in the BuildConfid.groovy
this error shows up again.
BuildConfig.groovy (repositories):
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
// mavenCentral()
// mavenRepo "http://repository.codehaus.org"
mavenRepo "http://download.java.net/maven/2/"
// mavenRepo "http://repository.jboss.com/maven2/"
mavenRepo "http://download.java.net/maven/2/"
mavenRepo "http://mavensync.zkoss.org/maven2"
mavenRepo "http://insecure.repo1.maven.org/maven2/"
}
Besides the obvious solution of upgrading Grails, to simply solve this problem it's possible to use Java 8 to download the dependencies and Java 7 to run the application.
grailsCentral()
and grailsPlugins()
):repositories {
mavenLocal()
mavenRepo "https://repo1.maven.org/maven2/"
mavenRepo "https://repo.grails.org/grails/core"
mavenRepo "https://repo.grails.org/grails/plugins"
mavenRepo "https://jaspersoft.jfrog.io/artifactory/third-party-ce-artifacts"
Don't forget to also remove the line with inherits true
.
If you want to do this only on Intellij, you can change SDK version at File > Project Structure > Project > SDK. Beware that Intellij may build Grails automatically so it might be necessary to restart the IDE.
The following are the commands to refresh the project's dependencies using Grails command refresh-dependencies
directly through Java in Linux or Windows.
Linux:
# Change java command to Java 8 full path if needed
G_HOME="</path/to/grails_home>" java -Dgrails.home="$G_HOME" \
-Dgroovy.starter.conf="$G_HOME/conf/groovy-starter.conf" \
-classpath "$G_HOME/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.1.9.jar:$G_HOME/dist/grails-bootstrap-2.3.4.jar" \
org.codehaus.groovy.grails.cli.support.GrailsStarter \
--main org.codehaus.groovy.grails.cli.GrailsScriptRunner \
--conf "$G_HOME/conf/groovy-starter.conf" \
"refresh-dependencies"
Windows CMD (Not tested):
set G_HOME=</path/to/grails_home>
# Change java command to Java 8 executable full path if needed:
java -Dgrails.home=%G_HOME% ^
-Dgroovy.starter.conf=%G_HOME%/conf/groovy-starter.conf ^
-classpath %G_HOME%/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.1.9.jar:%G_HOME%/dist/grails-bootstrap-2.3.4.jar ^
org.codehaus.groovy.grails.cli.support.GrailsStarter ^
--main org.codehaus.groovy.grails.cli.GrailsScriptRunner ^
--conf %G_HOME%/conf/groovy-starter.conf ^
refresh-dependencies
Don't forget to clean the project (delete the target
folder) and change Java version back to 7.
The problem is http://repo.grails.org is redirecting to https and no longer accepting http connections.
I tried using Java 7 and Maven with Grails https repository enabling TLS version 1.2 support and adding Java Cryptography Extension (JCE). Eventually got stuck in a TLS handshake problem which I was short in time to solve.