Maven:在pom.xml中更改版本

Maven:在pom.xml中更改版本,maven,properties,jenkins,pom.xml,Maven,Properties,Jenkins,Pom.xml,这不是项目版本的问题 我有一个Maven pom.xml。使用Jenkins构建项目并发布项目部署。 在创建发布前,请在Jenkins中设置发布前版本-own=0.0.25,发布后版本-own=0.0.27-SNAPSHOT 但是在构建版本版本之前和之后,我们需要在teg属性中设置我的版本,例如: 我已经在pom.xml中找到了 <properties> <version-own>0.0.21-SNAPSHOT</version-own> &l

这不是项目版本的问题

我有一个Maven pom.xml。使用Jenkins构建项目并发布项目部署。 在创建发布前,请在Jenkins中设置发布前版本-own=0.0.25,发布后版本-own=0.0.27-SNAPSHOT

但是在构建版本版本之前和之后,我们需要在teg属性中设置我的版本,例如: 我已经在pom.xml中找到了

<properties>
        <version-own>0.0.21-SNAPSHOT</version-own>
</properties>

<dependencies>
        <dependency>
                <groupId>com.test-release</groupId>
                <artifactId>features-test-release</artifactId>
                <version>${version-own}</version>
        </dependency>
</dependencies>
在发布之前,我需要这样设置

<properties>
        <version-own>0.0.25</version-own>
</properties>

<dependencies>
        <dependency>
                <groupId>com.test-release</groupId>
                <artifactId>features-test-release</artifactId>
                <version>${version-own}</version>
        </dependency>
</dependencies>
<properties>
        <version-own>0.0.27-SNAPSHOT</version-own>
</properties>

<dependencies>
        <dependency>
                <groupId>com.test-release</groupId>
                <artifactId>features-test-release</artifactId>
                <version>${version-own}</version>
        </dependency>
</dependencies>
发布后,我需要这样设置

<properties>
        <version-own>0.0.25</version-own>
</properties>

<dependencies>
        <dependency>
                <groupId>com.test-release</groupId>
                <artifactId>features-test-release</artifactId>
                <version>${version-own}</version>
        </dependency>
</dependencies>
<properties>
        <version-own>0.0.27-SNAPSHOT</version-own>
</properties>

<dependencies>
        <dependency>
                <groupId>com.test-release</groupId>
                <artifactId>features-test-release</artifactId>
                <version>${version-own}</version>
        </dependency>
</dependencies>

为什么不使用发行插件来解决这个问题呢。通过release plugin构建您的project Features测试版本,该版本将自动设置。在您依赖的当前项目中,只需使用发布插件将版本设置为下一个版本。或者使用versions-maven-plugin。我简单地描述了发布过程,需要在发布之前和之后设置手动属性版本,但是使用eclipse并不方便为什么需要这些属性。正如我在release plugin中所描述的,您不需要这些属性。使用新的依赖版本构建新的release项目。生成后,将所选依赖项设置为快照。的可能重复项