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 thin
When you added it to X, you should have incremented X's version number i.e X-1.2
Then X-1.2 should have been installed/deployed and you should have changed your projects dependency on X to be dependent on the new version X-1.2
I just deleted my ~/.m2/repository and that forced a re-download ;)
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
I think following command may help you!
mvn -U clean install
Most answers provided above would solve the problem.
But if you use IntelliJ and want it to just fix it for you automatically, go to Maven Settings.
Build,Execution, Deployment -> Build Tools -> Maven
Disable Work Offline
Enable Always update snapshots (Switch when required)
If you know the group id of X
, you can use this command to redownload all of X
and it's dependencies
mvn clean dependency:purge-local-repository -DresolutionFuzziness=org.id.of.x
It does the same thing as the other answers that propose using dependency:purge-local-repository
, but it only deletes and redownloads everything related to X
.