简体   繁体   English

Eclipse 使用Maven 更改项目版本?

[英]Eclipse Use Maven to change the version of a project?

I heard it's possible to change the version of a project using Maven.我听说可以使用 Maven 更改项目的版本。 I am talking about the tag <version>1.1</version> in the project "pom.xml" and all the pom file of all the sub project.我说的是项目“pom.xml”中的标签<version>1.1</version>和所有子项目的所有 pom 文件。

I want to do that because some project may have a lot of subproject and do it manually can be real losse of time.我想这样做是因为某些项目可能有很多子项目并且手动执行可能会浪费时间。

I am using eclipse if any of you know if it's even possible and if it is, how to do it?我正在使用 eclipse,如果你们中的任何人知道它是否可能,如果是,该怎么做?

Thanks in advance提前致谢

You can do that via the versions-maven-plugin via the following from the root of your project:您可以通过versions-maven-plugin从项目的根目录执行以下操作:

mvn versions:set -DnewVersion=1.2-SNAPSHOT

This will change all the versions in your pom files also of all your childs.这将更改您所有孩子的 pom 文件中的所有版本。 It will left over some backup file.它会留下一些备份文件。 This can either being solved by using the following:这可以通过使用以下方法解决:

mvn versions:commit

or maybe even better by starting with this:或者从这个开始可能会更好:

mvn versions:set -DnewVersion=1.2-SNAPSHOT -DgenerateBackupPoms=false

In my activities, to change the version of a project Eclipse using Maven, in Eclipse menu: Run > Debug Configurations, exists this Maven Builder (see the picture above) that change version when the button run is clicked and the newVersion parameter is filled:在我的活动中,要使用 Maven 更改项目 Eclipse 的版本,在 Eclipse 菜单中:Run > Debug Configurations,存在这个 Maven Builder(见上图),当单击运行按钮并填充 newVersion 参数时,它会更改版本:

在此处输入图像描述

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

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