mavenlocalversions

Maven installed version is preferred than a new one in the repo?


I'm trying to understand how does maven knows which jar to prefer when it comes to a jar that was installed by me manually (using mvn install) and there is a newer version in the repo of that jar. The version for both jar is -SNAPSHOT.

For example: I have 2 projects, core and application. Core has the version 1.0.0-SNAPSHOT and application has a dependency on that version.

From my computer I've compiled and installed my changes in core in order to test them in the application project.

A team mate has also changed things in core and deployed his version to our local repo.

When I'm doing mvn update, i'm not getting his changes.

Is that the normal behavior of maven?


Solution

  • If you build your project with the -U switch, you will force Maven to search remote repositories for udpated snapshots and releases.

    https://books.sonatype.com/mvnref-book/reference/running-sect-options.html