Java Maven 错误:“您在反应堆项目列表中没有 SNAPSHOT 项目。”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19235195/
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-08-12 15:18:38  来源:igfitidea点击:

Maven error: "You don't have a SNAPSHOT project in the reactor projects list."

javamaven

提问by Jacob

What on earth does this mean? Cant find any help via google.

这到底是什么意思?无法通过谷歌找到任何帮助。

>  mvn release:prepare
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Base 1.0.5
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-release-plugin:2.3.2:prepare (default-cli) @ base ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.386s
[INFO] Finished at: Tue Oct 08 08:22:46 EST 2013
[INFO] Final Memory: 9M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project base: You don't have a SNAPSHOT project in the reactor projects list. -> [Help 1]

采纳答案by eis

release:prepare command is supposed to prepare your snapshot project for the release. It sounds like you don't have such a snapshot project.

release:prepare 命令应该为发布准备您的快照项目。听起来您没有这样的快照项目。

Here's the full details what it'll do: http://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html

这是它会做什么的完整细节:http: //maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html

If you're sure you should be releasing, you should be working on a maven module that has version ending with -SNAPSHOT.

如果你确定你应该发布,你应该在一个版本以-SNAPSHOT.

Update: like noted by @khmarbaise in the comments, if your release has failed, you should do release:rollbackto go back to previous state. Note though that it is not supported if you release through jenkins(jenkins issue), and it won't rollback the tags.

更新:就像@khmarbaise 在评论中指出的那样,如果您的发布失败,您应该release:rollback回到以前的状态。请注意,如果您通过 jenkins 发布jenkins 问题),则不支持它,并且它不会回滚标签

回答by Stuart

I know this is an old question but I had this issue recently and I found 2 solutions that others may find useful. I am using bamboo as my CI tool. The issue was that there was an error in the bamboo build leaving bamboo in an incorrect state. It had locally updated my project pom.xml with the new release version but had not checked this into SVN. The two solution that worked for me were:

我知道这是一个老问题,但我最近遇到了这个问题,我找到了 2 个其他人可能觉得有用的解决方案。我使用竹子作为我的 CI 工具。问题是竹子构建中存在错误,导致竹子处于不正确的状态。它已经使用新的发布版本在本地更新了我的项目 pom.xml,但没有将其签入 SVN。对我有用的两个解决方案是:

Either

任何一个

  1. Delete the bamboo build-dir directory for the project and run the release again: rm -rf /opt/bamboo-home/xml-data/build-dir/PROJECT_NAME-RELEASE-JOB1
  1. 删除项目的bamboo build-dir目录,再次运行release:rm -rf /opt/bamboo-home/xml-data/build-dir/PROJECT_NAME-RELEASE-JOB1

OR

或者

  1. Run the maven release from the command line using the following commands:

    mvn release:prepare -DignoreSnapshots -Dresume=false

    mvn release:perform

  1. 使用以下命令从命令行运行 maven 版本:

    mvn 发布:准备 -DignoreSnapshots -Dresume=false

    mvn 发布:执行

回答by Cristan

I've had the same error with Jenkins. In a previous release, Jenkins updated the version of the POM to a non-snapshot version, but the build failed before Jenkins could set the version to a -SNAPSHOT version again. Afterwards, making a release resulted in the error described above.

我和詹金斯有同样的错误。在之前的版本中,Jenkins 将 POM 的版本更新为非快照版本,但在 Jenkins 再次将版本设置为 -SNAPSHOT 版本之前构建失败。之后,发布导致上述错误。

Fixing this is easy: just manually change the version of your app in pom.xml to a -SNAPSHOT version.

解决这个问题很容易:只需手动将 pom.xml 中的应用程序版本更改为 -SNAPSHOT 版本。

回答by zombi_man

Don't needed manually edit pom.xml. You can use "mvn versions:set" for batch update, something like this:

不需要手动编辑 pom.xml。您可以使用“mvn versions:set”进行批量更新,如下所示:

mvn versions:set -DnewVersion=1.0.3-SNAPSHOT

回答by TomaszZ.

No need to update versions manually as that is time consuming, if version change is all you need, there is a different command that only updates the pom versions, just like updating them manually:

无需手动更新版本,因为这很耗时,如果您只需要更改版本,则有一个不同的命令只更新 pom 版本,就像手动更新它们一样:

mvn versions:set -DgenerateBackupPoms=false -DnewVersion=1.0.XX-SNAPSHOT