Purge local maven repo of all SNAPSHOT dependencies

java, maven

Solution

Yes there is this flexibility available to filter dependencies also to specify just SNAPSHOTS

try

mvn dependency:purge-local-repository -DmanualInclude="com.abc:artifact-id" -DsnapshotsOnly=true

Problem

I am in an environment where multiple versions of a jar file with the same name can be published to a local Nexus installation. These jar files are always named XYZ-SNAPSHOT.jar. Our continuous integration system needs to always pull the latest version, so our automated build currently contains the following to wipe out the complete local repo on the Continuous Integration machine: mvn dependency:purge-local-repository This forces all dependencies to be downloaded on each build, which makes it take a very long time. Is there some way to use the 'includes' flag with a wildcard. Something that I would assume looks like this: mvn dependency:purge-local-repository -includes="*-SNAPSHOT.jar" It would also be acceptable to add a new mvn target if that has the necessary flexibility.

Original source