Synchronize the nexus build number with the hudson / jenkins build number

I would like to tell nexus to give the deployed snapshot the same build number as the 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?

+3
source share
2 answers

In Hudson / Jenkins, you can use ${BUILD_NUMBER}as a parameter in your assemblies. Pass this into your maven structure as mvn clean package -Dbuild.number=${BUILD_NUMBER}or use it in the steps after the build, as you like.

This may help you answer, but I don't know Nexus enough to provide a complete solution.

+3
source

, maven\nexus, . (\ ) SNAPSHOT.

maven-release-plugin, ? \ VCS .

-1

Source: https://habr.com/ru/post/1796392/


All Articles