[英]snapshot version not published after upgrading maven-release-plugin to 2.5.2
Snapshot version is not published on snapshot repository but release version is published instead. 快照版本未发布在快照存储库中,而是发布了发行版本。
Release is successful. 发布成功。 No errors.
没有错误。
Only change is upgrade of release plugin from 2.3.2 to 2.5.2 唯一的变化是发布插件从2.3.2升级到2.5.2
Also tried 2.5.1 and 2.5.3 but none worked. 还尝试了2.5.1和2.5.3,但没有一个有效。
Using apache maven 3.5.0 使用Apache Maven 3.5.0
Steps: 脚步:
Output: Build Success in all three 输出:三者均成功
Not sure if I can attach actual logs 不知道我是否可以附加实际日志
snippet pom.xml 片段pom.xml
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<artifactId>maven-overview-plugin</artifactId>
<version>1.6</version>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5</version>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<scmCommentPrefix>: Release by maven </scmCommentPrefix>
<tagNameFormat>bcd-@{project.version}</tagNameFormat>
<arguments>-Denvironment=target</arguments>
</configuration>
<repository>
<id>apache.snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<distributionManagement>
<repository>
<id>arm</id>
<name>Internal release Repository</name>
<url>url1</url>
</repository>
<snapshotRepository>
<id>arm</id>
<name>Internal Repository</name>
<url>url2</url>
</snapshotRepository>
Your problem is caused by issue MRELEASE-812 in the Maven Release plugin affecting 2.3.2 and solved since 2.5. 您的问题是由影响2.3.2的Maven Release插件中的MRELEASE-812问题引起的,自2.5起已解决。 However, the plugin is actually supposed to publish the Release version of your app , not the Snapshot version.
但是, 该插件实际上应该发布应用程序的发布版本 ,而不是快照版本。 When you say:
当你说:
Snapshot version is not published on snapshot repository but release version is published instead.
快照版本未发布在快照存储库中,而是发布了发行版本。
Snapshot version is not supposed to be published on repository when using the Release plugin. 使用Release插件时,不应在存储库中发布快照版本。 Publication of the release version is actually expected.
实际上,预计会发布该发行版本。 Detailed explanation below.
详细说明如下。
What should happen when you use mvn release:prepare release:perform
: 使用
mvn release:prepare release:perform
会发生什么:
release:prepare
will update your project from version xyz-SNAPSHOT
to xyz
(the "release" version of your project) commit+push all changes into your Git repository (or any other SCM) and create a tag named bcd-xyz
release:prepare
会将您的项目从xyz-SNAPSHOT
版本更新为xyz
(项目的“发行”版本)commit +将所有更改推入Git存储库(或任何其他SCM)中,并创建一个名为bcd-xyz
的标签 release:perform
will checkout/pull from the tagged release bcd-xyz
release and deploy it on your repository release:perform
将从签出的发行版bcd-xyz
发行版中检出/拉出并将其部署到您的存储库中 xyz
is now deployed on your Repo. xyz
已部署在您的仓库中。 This is actually what happened when you used version 2.5.2 of the Release plugin, and is actually the expected and normal behavior. 这实际上是您使用Release插件的2.5.2版时发生的情况, 并且实际上是预期的和正常的行为。
Here is what happened when you used version 2.3.2 of the plugin: 这是您使用插件的版本2.3.2时发生的情况:
release:prepare
updated your project from version xyz-SNAPSHOT to xyz, the "release" version of your project, however the changes never got pushed to Git due to MRELEASE-812 . release:prepare
将项目从xyz-SNAPSHOT版本更新为xyz(项目的“发布”版本), 但是由于MRELEASE-812 ,更改从未推送到Git。 A tagged thus got created using the xyz-SNAPSHOT
version of your project instead of the proper release version because the changes updating your version number never got pushed. xyz-SNAPSHOT
版本而不是正确的发行版本创建了标记,因为从未更新更新版本号的更改。 release:perform
will checked out the *improperly named * tag bcd-xyz
actually containing the xyz-SNAPSHOT
version and deployed it on your repository as a SNAPSHOT. release:perform
将检出实际上包含xyz-SNAPSHOT
版本的*命名错误的*标签bcd-xyz
并将其作为SNAPSHOT部署在您的存储库中。 xyz-SNAPSHOT
was now available on your repo. xyz-SNAPSHOT
现在在您的存储库中可用。 Maven never shown any error but this is not proper behavior. Maven从未显示任何错误,但这不是正确的行为。 Your real issue was actually with your previous usage of the Plugin, and your build is now having the expected behavior ;)
您真正的问题实际上是您先前使用的插件,现在您的构建具有预期的行为;)
What you can do: 你可以做什么:
mvn deploy
on a revision containing a SNAPSHOT version instead of creating a release. mvn deploy
而不是创建发行版。 Hope this helps. 希望这可以帮助。 Do not hesitate to ask details I'll update my answer.
请随时询问详细信息,我将更新我的答案。
This is expected as per the command/goals you are using: 根据您使用的命令/目标,这是预期的:
mvn clean install
installs your SNAPSHOT dependency on your local repository but it DOES NOT deploy it on your Maven repository mvn clean install
将SNAPSHOT依赖项安装在本地存储库上,但不会将其部署在Maven存储库上 mvn release:prepare
update your POMs for a release version and update your SCM with tag mvn release:prepare
将您的POM更新为版本,并使用标签更新SCM mvn release:perform
actually deploys your release on repository mvn release:perform
实际上将您的发布部署在存储库上 Your SNAPSHOT nevers get deployed on any repository. 您的SNAPSHOT永远不会部署在任何存储库上。 To achieve this, you should run the
deploy:deploy
goal before using the release:*
goals. 为此,应在使用
release:*
目标之前运行deploy:deploy
目标。 For example: 例如:
mvn clean install deploy:deploy release:prepare release:perform
Equivalent to: 相当于:
mvn clean deploy release:prepare release:perform
Note that your pom.xml and repository should be properly configured to allow the deployment of SNAPSHOT artifacts. 请注意,应正确配置pom.xml和存储库,以允许部署SNAPSHOT工件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.