eclipse 如何在没有pom备份文件的情况下更新maven版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15978218/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 21:39:59  来源:igfitidea点击:

How to update the maven version without pom backup files

eclipsemavenversions-maven-plugin

提问by Jess

How do you run maven with the versions plugin to update the version inside several pom.xml files and not get the annoying pom.xml.versionsBackupfiles? (I have my poms in version control, so I don't need a backup).

你如何使用版本插件运行 maven 来更新几个 pom.xml 文件中的版本而不是获得烦人的pom.xml.versionsBackup文件?(我的 poms 在版本控制中,所以我不需要备份)。

I run this command to update the version:

我运行此命令来更新版本:

mvn versions:set -DnewVersion=3.8.0-SNAPSHOT

mvn versions:set -DnewVersion=3.8.0-SNAPSHOT

回答by Jess

To prevent creating backup files, use generateBackupPomsinstead:

要防止创建备份文件,请generateBackupPoms改用:

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

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

I also saw that you can set up generateBackupPomsin the plugin section of a pom.xml if you want to do it that way.

我还看到如果你想这样做,你可以在 pom.xml 的插件部分设置generateBackupPoms

Note if you are using eclipse, you can run the command using a run configuration like this:

请注意,如果您使用的是 eclipse,则可以使用如下运行配置运行该命令:

enter image description here

在此处输入图片说明

See also: http://www.mojohaus.org/versions-maven-plugin/set-mojo.html

另见:http: //www.mojohaus.org/versions-maven-plugin/set-mojo.html

回答by eXistPierre

After mvn versions:set, run the command mvn versions:commit.

之后mvn versions:set,运行命令mvn versions:commit

All of the pom backups will be deleted.

所有的 pom 备份都将被删除。

回答by Srikanth Chadalavada

mvn versions:set -DgenerateBackupPoms=falsedeletes the backups and will also ask the new version to be set instead of passing the version in the command.

mvn versions:set -DgenerateBackupPoms=false删除备份并且还会要求设置新版本而不是在命令中传递版本。