MavenCentral Dependencies Failing To Resolve

As of January 15, 2020 Sonatype, the hosts of the Maven Central repository will no longer be permitting insecure connections to their repository via http. More information on the why´s can be found here.

So if you´re working on a Grails application that uses the mavenCentral() repo, and suddenly on a rebuild or refresh of dependencies you find MavenCentral depenedencies are failing to resolve filling your log with a whole stack of the following errors:

SERVER ERROR: HTTPS Required <URL of POM/jar>

Then the solution is to modify your buildConfig.groovy and replace mavenCentral() with the secure HTTPS explicit URL. You can go ahead and replace all the default insecure repositories as such.

Replacing

grailsPlugins()
mavenCentral()
grailsCentral()

with…

mavenRepo "https://repo.grails.org/grails/plugins/"
mavenRepo "https://repo1.maven.org/maven2/"
mavenRepo "https://grails.org/plugins/"

Once updated, you should find your dependencies pull down without failure once again.

David Brown founded Tucanoo Solutions in 2011 and has written software in a professional capacity for over 30 years, back to the Java/J2EE days of Sun Microsystems. He builds cloud and web applications for clients in legal tech, government and beyond, including several years consulting to the United Nations on customs and transport systems. He writes these tutorials himself, with the full code on GitHub.

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *