将 Nexus 内部版本号与 hudson/jenkins 内部版本号同步
我想告诉 Nexus 为已部署的快照提供与分配给构建的 jenkins 相同的构建号。
澄清一下:
<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
<groupId>com.bmw.psdz</groupId>
<artifactId>psdz-api</artifactId>
<version>4.3.3-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20110304.122623</timestamp>
<buildNumber>4</buildNumber> <!-- this should be same build number as jenkins assigned to the build -->
</snapshot>
<lastUpdated>20110304122623</lastUpdated>
<snapshotVersions>
<snapshotVersion>
<extension>jar</extension>
<value>4.3.3-20110304.122623-4</value>
<updated>20110304122623</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom</extension>
<value>4.3.3-20110304.122623-4</value>
<updated>20110304122623</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>
这可能吗?
I would like to tell nexus to give a deployed snapshot the same build number as jenkins assigned to the build.
To clarify:
<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
<groupId>com.bmw.psdz</groupId>
<artifactId>psdz-api</artifactId>
<version>4.3.3-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20110304.122623</timestamp>
<buildNumber>4</buildNumber> <!-- this should be same build number as jenkins assigned to the build -->
</snapshot>
<lastUpdated>20110304122623</lastUpdated>
<snapshotVersions>
<snapshotVersion>
<extension>jar</extension>
<value>4.3.3-20110304.122623-4</value>
<updated>20110304122623</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom</extension>
<value>4.3.3-20110304.122623-4</value>
<updated>20110304122623</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>
Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Hudson/Jenkins 中,您可以使用
${BUILD_NUMBER}
作为构建中的参数。将其传递到您的 Maven 构建中,例如mvn clean package -Dbuild.number=${BUILD_NUMBER}
,或者根据需要在构建后步骤中使用它。这可能会帮助您找到答案,但我对 Nexus 的了解还不足以提供完整的解决方案。
In Hudson/Jenkins you can use
${BUILD_NUMBER}
as a parameter in your builds. Pass this in to your maven build likemvn clean package -Dbuild.number=${BUILD_NUMBER}
, or use it in post-build steps as you like.This may help you towards an answer, but I don't know enough Nexus to provide a complete solution.
如果是我,如果我关心版本信息,我会希望在 maven\nexus 中使用该工件的发布版本。我通常不会关心(或想要)区分不同的快照版本。
使用 maven-release-plugin 对您有用吗 创建一个版本作为构建的一部分?这可能包括 Hudson 内部版本号和/或 VCS 修订号,作为版本控制方案的一部分。
If it was me, I'd be looking to use a released version of the artefact in maven\nexus if I cared about the version information. I wouldn't normally care (a\or want to) differentiate between different SNAPSHOT versions.
Would it work for you to use the maven-release-plugin to create a version as part of the build? This could include the Hudson build number and\or the VCS revision number as part of your versioning scheme.