Force re-download of release dependency using Maven

volni picture volni · Oct 31, 2011 · Viewed 222.1k times · Source

I'm working on a project with dependency X. X, in turn, depends on Y.

I used to explicitly include Y in my project's pom. However, it was not used and to make things cleaner, I instead added it to X's pom as a dependency. X is marked as a release dependency.

The problem is that after removing Y from my project's pom and adding it to X's pom, my project isn't picking it up on mvn -U clean package. I know -U update snapshots but not releases.

So, without deleting the ~/.m2/repository directory how can I force a re-download of X's pom? Also, I tried running dependency:purge-local-repository and it didn't work either.

Answer

Ali Tokmen picture Ali Tokmen · Dec 24, 2011

You cannot make Maven re-download dependencies, but what you can do instead is to purge dependencies that were incorrectly downloaded using mvn dependency:purge-local-repository

See: http://maven.apache.org/plugins/maven-dependency-plugin/purge-local-repository-mojo.html