简体   繁体   English

Maven SNAPSHOT被认为是RELEASE

[英]Maven SNAPSHOT are taken into account as RELEASE

I have Java projects compiled with maven. 我有用maven编译的Java项目。 Each project has its own POM which looks like the following : 每个项目都有自己的POM,如下所示:

<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 SNAPSHOT作为发布

If I do a mvn install , it will compile/install it the first time I execute the command. 如果我执行mvn install ,它将在我第一次执行命令时编译/安装它。 Next times, it won't install it. 下次,它不会安装它。 It seams that maven consider it as a RELEASE , weither it is a SNAPSHOT . 它认为maven认为它是一个RELEASE ,它们都是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. 我相信我错过了maven配置,但这对我们的开发产生了很大影响,因为我们强制要求为每个测试部署更改项目版本(及其依赖性)。

Notes : I'm using maven 3.3.3. 注意:我正在使用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). 看起来我在3.1.0中没有这种行为(我不是100%肯定旧版本。无论如何都很老)。 Maven is coupled with Nexus. Maven与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 ? 编辑:问题是:我怎样才能让maven每次都安装SNAPSHOT而不是第一次像RELEASE一样?

EDIT SOLVED 编辑已解决

We've always done mvn install to compile and install the sources. 我们总是用mvn install来编译和安装源代码。 For some reason, we haven't used the mvn clean command. 出于某种原因,我们还没有使用mvn clean命令。 The correct maven command to recompile all the sources is mvn clean install . 重新编译所有源的正确maven命令是mvn clean install

Thank you @VinayVeluri 谢谢@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. 添加后,此命令行arg强制Maven检查远程存储库中的所有快照,并在其过期时更新本地存储库。

source 资源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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