mavenpluginsmaven-dependency-pluginpurge

What does purge-local-repository actually purge?


I am running the following command from within a maven project directory:

mvn dependency:purge-local-repository

What is the expected behavior?

Will it delete (and re-download?) all the dependencies already existing in my local repo for that particular project (i.e. whose directory I am in) or will it delete all the contents of my local repo?


Solution

  • By default, purge-local-repository will remove from the local repository all the files associated to the version of each dependency (including transitive) of the project it is ran on:

    Remove the project dependencies from the local repository, and optionally re-resolve them.

    The several factors coming into play are:

    You can see which artifacts are going to be purged by printing the list of all dependencies for the project with the list goal:

    mvn dependency:list
    

    optionally adding excludeTransitive to this command, if you decide not to purge transitive dependencies.