How to force maven update?
mvn clean install -U
-U
means force update of snapshot dependencies.
Release dependencies will be updated this way if they have never been previously successfully downloaded. ref: https://stackoverflow.com/a/29020990/32453
If your local repository is somehow mucked up for release jars as opposed to snapshots (-U
and --update-snapshots
only update snapshots), you can purge the local repo using the following:
mvn dependency:purge-local-repository
You probably then want to clean and install again:
mvn dependency:purge-local-repository clean install
Lots more info available at https://maven.apache.org/plugins/maven-dependency-plugin/examples/purging-local-repository.html
-U
seems to force update of all SNAPSHOT dependencies.
If you want to update a single dependency without clean or -U
you could just remove it from your local repo and then build.
The example below if for updating slf4j-api 1.7.1-SNAPSHOT
:
rm -rf ~/.m2/repository/org/slf4j/slf4j-api/1.7.1-SNAPSHOT
mvn compile
All the answers here didn't work for me. I used the hammer method:
find ~/.m2/ -name "*.lastUpdated" | xargs rm
That fixed the problem :-)
You can do effectively from Eclipse IDE
. Of course if you are using it.
Project_Name->Maven->Update Project Configuration->Force Update of Snapshots/Releases