If the dependency is a unique version of the snapshot and installation is called, what does maven choose?

Imagine two projects. The first is a project framework-corethat is in version 1.1.0and has several shots. Another is the project example-business, which has the following dependency on framework-corethe build version number.

<dependency>
  <groupId>org.example</groupId>
  <artifactId>framework-core</artifactId>
  <version>1.1.0-20100518.134928-9</version>
</dependency>

What happens if mvn installcalled on framework-core? I found out that the artifact was copied to the folder and named *.1.1.0-SNAPSHOT.jar(as expected).

This led me to the assumption that this version is used, even if this version 1.1.0-SNAPSHOTis defined as a dependency, and not an exact assembly.

To check for something local without deploying it to the maven repository: call mvn install, change the dependency to 1.1.0-SNAPSHOT- and just installed artifact? Or is it possible to rewrite a specific assembly (using the life cycle phase install)?

+3
source share
1 answer

When using a dependency with a timestamp -SNAPSHOT-like version, -20100518.134928-9in this case you will block the version and explicitly tell Maven to use this version . Even if a new one -SNAPSHOTis created, the dependency will not be updated that point is a "locked snapshot".

-SNAPSHOT, -SNAPSHOT, :

<dependency>
  <groupId>org.example</groupId>
  <artifactId>framework-core</artifactId>
  <version>1.1.0-SNAPSHOT</version>
</dependency>

, Maven plugin :

+6

All Articles