Maven repositories
I needed to do some work on an old Maven project I have that I’ve worked on for years, and when I fired up my handy Netbeans IDE and ran the obligatory “priming build”, I was surprised to get an error on one of the basic Maven plugins.
Now I’ve worked through similar issues to this before, so I probably could have remembered the root cause, but looking at my screen and seeing the log it appeared I had some corruption in my local repository:
Downloading: http://repository.codehaus.org/org/apache/maven/plugins/maven-dependency-plugin/2.10/maven-dependency-plugin-2.10.pom Checksum validation failed, expected <html><head><meta but is cc7e7b50f5869e93e079c99ea43e1bc4079951a7 for http://repository.codehaus.org/org/apache/maven/plugins/maven-dependency-plugin/2.10/maven-dependency-plugin-2.10.pom Checksum validation failed, expected cc7e7b50f5869e93e079c99ea43e1bc4079951a7 for http://repository.codehaus.org/org/apache/maven/plugins/maven-dependency-plugin/2.10/maven-dependency-plugin-2.10.pom Downloaded: http://repository.codehaus.org/org/apache/maven/plugins/maven-dependency-plugin/2.10/maven-dependency-plugin-2.10.pom (429 B at 0.4 KB/sec) The POM for org.apache.maven.plugins:maven-dependency-plugin:jar:2.10 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details ------------------------------------------------------------------------ BUILD FAILURE ------------------------------------------------------------------------ Total time: 5.089s Finished at: Sun Oct 04 14:23:00 MDT 2015 Final Memory: 8M/245M ------------------------------------------------------------------------ Failed to parse plugin descriptor for org.apache.maven.plugins:maven-dependency-plugin:2.10 (/Users/robweaver/.m2/repository/org/apache/maven/plugins/maven-dependency-plugin/2.10/maven-dependency-plugin-2.10.jar): error in opening zip file -> [Help 1] To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging. For more information about the errors and possible solutions, please read the following articles: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginDescriptorParsingException
So I wasted some time looking at the plugin section of my POM, wondering if it was because I had a newer version of NB (and therefore Maven), or if there was a problem on my local folder.
After trying a number of things, including deleting my local repository in the ~/.m2 folder, I decided to run mvn with the “-X” flag to see more details:
Downloading: http://repository.codehaus.org/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom [WARNING] Checksum validation failed, expected <html><head><meta but is 1ea215fdb8fb14b34e2fa26350db1261cc57787d for http://repository.codehaus.org/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom [WARNING] Could not validate integrity of download from http://repository.codehaus.org/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom org.eclipse.aether.transfer.ChecksumFailureException: Checksum validation failed, expected
And noticing that it was looking for a check but seeing HTML, which told me that there was something wrong with the download from http://repository.codehaus.org
Back to my trusty Google, and pretty soon I came across an search result saying that CodeHaus.org wasn’t hosting a repo any more. In fact the HTML I saw in the log was due to the way my ISP (CenturyLink) handles addresses that don’t exist any longer, displaying a sort of web search page.
After more digging, I found this page http://www.codehaus.org/mechanics/maven/ which talked about Codehaus no longer serving repositories, so I tried the suggestion there (with no luck).
Now I probably should have remembered that one of the things to love and hate about Maven, is that you can define things in all sorts of different ways. Doing a quick search through my project’s pom.xml file, I found the culprit: A plugin repository was defined in the XML that was pointing to the offending url:
<pluginRepositories> <pluginRepository> <id>prime-repo</id> <name>PrimeFaces Maven Repository http://repository.primefaces.org oss.sonatype.org-github-releases oss.sonatype.org - github-releases http://oss.sonatype.org/content/repositories/github-releases codehaus Codehaus Release Repo http://repository.codehaus.org
And the fix was actually just to remove the Codehaus specific pluginRepository entry (since the plugin I needed is actually hosted in the main repo anyway).