Maven update for specific dependency only (mvn -U for selected dependencies)

The mvn -U command forces all dependencies for updating from a remote repository. Is it possible to force such an update for a specific choice of dependencies, by explicit choice / by some logic?

Justification

I don’t want to force-check all the dependencies that we have, because for how long it takes time. All I need to do is check some of them or even indicate only one dependency. Therefore, such a solution is highly desirable.

+5
source share
1 answer

There are two maven plugins that can help you.

First, the dependency will simply load the specified version of the dependency: mvn dependency:get -Dartifact=groupId:artifactId:version

Second version offers some behaviors that may also be useful.

By running mvn versions:use-latest-releases -Dincludes=groupId:artifactId , your pom project will be updated with the latest version of the dependency version indicated by the '-Dincludes' flag. Then you can run the first command to download the version that your pom refers to.

Both of these behaviors can be highly customized and automated to do some pretty amazing things. For more information about the plugin, run: mvn plugin:help -Ddetail=true -Dgoal=goal

Example: mvn versions:help -Ddetail=true -Dgoal=use-latest-releases

For more information: versions , dependency and plugins

+3
source

Source: https://habr.com/ru/post/1210468/


All Articles