简体   繁体   中英

Maven SNAPSHOT are taken into account as RELEASE

I have Java projects compiled with maven. Each project has its own POM which looks like the following :

<project ...>
    <groupId>group.id</groupId>
    <artifactId>scripts</artifactId>
    <version>1.0.1-SNAPSHOT</version>
    ...
    <dependencies>
          <dependency>
              <groupId>global</groupId>
              <artifactId>common</artifactId>
              <version>10.2.3-SNAPSHOT</version>
          </dependency>
    </dependencies>
    ...
</project>

SNAPSHOT as a RELEASE

If I do a mvn install , it will compile/install it the first time I execute the command. Next times, it won't install it. It seams that maven consider it as a RELEASE , weither it is a SNAPSHOT . I can see that in the timestamp included into the installed package. if I don't change the version number, the timestamp does not change either.

I believe I miss a maven configuration but this impacts a lot our development as we're force to change the projects versions (and their dependancies) for every test deployment.

Notes : I'm using maven 3.3.3. It looks like I had not this behavior in 3.1.0 (I'm not 100% sure of the old version. Very old anyway). Maven is coupled with Nexus. Maybe the issue comes from it and I'm focussing on the wrong horse.

Thank you for the hints.

Edit : the question is : How can I get maven installing SNAPSHOTs everytime instead of the first time only like a RELEASE ?

EDIT SOLVED

We've always done mvn install to compile and install the sources. For some reason, we haven't used the mvn clean command. The correct maven command to recompile all the sources is mvn clean install .

Thank you @VinayVeluri

If versions are needed for the code changes, Please version yourself for the code base, though it is cumbersome gives the idea of versioning.

If it has to automatic regarding the snapshots update, then use

mvn -u clean install

Once added, this command line arg forces Maven to check all snapshots in a remote repository and update your local repository if it's out of date.

source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM