Do you get a weird build failure caused by a dependency while it works for everyone else using the same (or similar) maven settings? I did and some research led me to believe that the local maven proxy contained one or more corrupted maven artifacts.
Here’s how to locate the bad artifacts:
- Empty your local maven repository at $HOME/.m2/repository by moving it to a different directory (to “repository.old”)
- Configure maven (in $HOME/.m2/settings.xml) to not use your local maven proxy (In my case Nexus)
- Execute the build that previously failed. Now it should work, because you’re getting the good version of the artifact.
- Restore the original settings.xml, move your local repository to repository.good. Now the build should fail again.
- Repeat step 3 (rename the repository directory to “repository.bad”)
- Find duplicates in repository.good and repository.bad, using fdupes or a similar tool, and delete them:
fdupes -rdN repository.bad repository.good
- Compare the remaining, different artifacts in repository and repository.good
These commands find the jar, ear and war-files which are present in both repositories, having different md5sums:
cd repository.good for path in $(find . -type f|grep -vE '(sha|pom|md5)'); do if [ -e ../repository.bad/$path ]; then echo $path; fi; done
Once found, the bad artifacts must be deleted from your maven proxy.