I am not able to build my 2.3.7 grails projects since the maven central repository has moved to https. I tried the recommandations on this post : Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body
However I'am still having an issue because the maven repo is coded in the framework jars ( grails-aether-2.3.7-sources.jar ) The class is org.codehaus.groovy.grails.resolve.maven.aether.config.RepositoriesConfinguration.groovy.
RemoteRepository mavenCentral(Closure configurer = null) {
final existing = repositories.find { ArtifactRepository ar -> ar.id == "mavenCentral" }
if (!existing) {
final repositoryBuilder = new RemoteRepository.Builder("mavenCentral", "default", "http://repo1.maven.org/maven2/")
configureRepository(repositoryBuilder, configurer)
final repository = repositoryBuilder.build()
repositories << repository
return repository
}
else {
return existing
}
}
This file is readonly.
How can I fix this issue? I cannot migrate the project to a new Grails version for several reasons. This is the error I got.
16:14:10 + /opt/grails-2.3.7/bin/grails --stacktrace clean 16:14:13 | Loading Grails 2.3.7 16:14:17 | Configuring classpath 16:14:20 | Error Resolve error obtaining dependencies: Failed to read artifact descriptor for xalan:serializer:jar:2.7.1 (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.) 16:14:20 org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for xalan:serializer:jar:2.7.1 16:14:20 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:335) 16:14:20 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217) 16:14:20 at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:466) 16:14:20 at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:261) 16:14:20 at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:317) 16:14:20 at grails.util.BuildSettings.doResolve(BuildSettings.groovy:513) 16:14:20 at grails.util.BuildSettings.doResolve(BuildSettings.groovy) 16:14:20 at grails.util.BuildSettings$_getDefaultBuildDependencies_closure17.doCall(BuildSettings.groovy:774) 16:14:20 at grails.util.BuildSettings$_getDefaultBuildDependencies_closure17.doCall(BuildSettings.groovy) 16:14:20 at grails.util.BuildSettings.getDefaultBuildDependencies(BuildSettings.groovy:768) 16:14:20 at grails.util.BuildSettings.getBuildDependencies(BuildSettings.groovy:673) 16:14:20 Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact xalan:serializer:pom:2.7.1 from/to mavenCentral (http://repo1.maven.org/maven2/ ): HTTPS Required (501) 16:14:20 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:460) 16:14:20 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262) 16:14:20 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239) 16:14:20 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:320) 16:14:20 ... 10 more 16:14:20 Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact xalan:serializer:pom:2.7.1 from/to mavenCentral (http://repo1.maven.org/maven2/ ): HTTPS Required (501) 16:14:20 at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43) 16:14:20 at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:342) 16:14:20 at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67) 16:14:20 at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:649) 16:14:20 at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:247) 16:14:20 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:536) 16:14:20 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:437) 16:14:20 ... 13 more 16:14:20 Caused by: org.apache.http.client.HttpResponseException: HTTPS Required (501) 16:14:20 at org.eclipse.aether.transport.http.HttpTransporter.handleStatus(HttpTransporter.java:404) 16:14:20 at org.eclipse.aether.transport.http.HttpTransporter.execute(HttpTransporter.java:298) 16:14:20 at org.eclipse.aether.transport.http.HttpTransporter.implGet(HttpTransporter.java:250) 16:14:20 at org.eclipse.aether.spi.connector.transport.AbstractTransporter.get(AbstractTransporter.java:59) 16:14:20 at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:418) 16:14:20 at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:337) 16:14:20 ... 18 more
You have to comment out mavenCentral() under repositories and add corresponding https url as suggested here : https://support.sonatype.com/hc/en-us/articles/360041287334
Example :
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
//comment following line to prevent use of default http url
// mavenCentral()
//add following https counterparts
mavenRepo 'https://repo1.maven.org/maven2/'
mavenRepo 'https://repo.maven.apache.org/maven2/'
//if by any chance you can't connect to https url use this insecure url
// mavenRepo 'http://insecure.repo1.maven.org/maven2/'
mavenRepo 'https://repo.spring.io/milestone'
}
I tried this for grails 2.3.11 and java 1.7.0_242 and it worked for me. Hope this helps.
I was dealing with Grails 2.3.11 and I just added the following repository and changed any other external repository URLs to https:
repositories {
mavenRepo "https://repo.grails.org/grails/core"
Also I had to use Java 8 due to the TLS default being 1.2 in Java 8. The bummer is Grails 2.3.7 does not support Java 8.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With