开发者

Synchronize nexus build number with hudson/jenkins build number

开发者 https://www.devze.com 2023-02-15 02:04 出处:网络
I would like to tell nexus to give a deployed snapshot the same build number as jenkins assigned to the build.

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 je开发者_如何学运维nkins 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?


In Hudson/Jenkins you can use ${BUILD_NUMBER} as a parameter in your builds. Pass this in to your maven build like mvn 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号