我使用versions-maven插件来更新项目版本。我想安装这个更新版本的工件,但maven-install插件使用旧版本。如何配置项目以实现所描述的行为?Maven安装插件不使用版本插件更新版本
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
</executions>
<configuration>
<propertyPrefix>parsedVersion</propertyPrefix>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<executions>
<execution>
<id>update-version</id>
<phase>validate</phase>
<goals>
<goal>set</goal>
<goal>commit</goal>
</goals>
<configuration>
<newVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}-${SVN_REVISION}</newVersion>
</configuration>
</execution>
</executions>
</plugin>
通常我会想到的是,因为版本的插件在验证阶段执行有关Maven的生命周期中安装插件应该采取新的版本。
版本,Maven的插件:设定目标,仅用于内部的命令行运行和NOT lifecycle ...永远不会工作,导致版本 - maven-plugin:set目标将改变pom.xml文件,但在运行期间,pom.xml已经被加载到内存中,因此结果是你将总是安装旧的版本。您使用哪个Maven版本? – khmarbaise
嗨,谢谢你的回答,我使用Maven 3.3.x.从命令行使用版本插件后,它的工作!也许有人有相同的用例:build-helper:parse-version版本:set -DnewVersion = $ {parsedVersion.majorVersion}。$ {parsedVersion.minorVersion}。$ {parsedVersion.incrementalVersion} - $ {SVN_REVISION} – desert