Obtaining Generated Unique Version from Maven Snapshots

前端 未结 1 1620
小鲜肉
小鲜肉 2021-01-18 20:43

As per the manual, with Maven 3 we\'re forced to use uniqueSnapshots=true. This means that each deployment of 1.0-SNAPSHOT is actually backed by so

相关标签:
1条回答
  • 2021-01-18 21:47

    The maven-deploy-plugin does not store the deployment timestamp in system properties.

    If you want to take a look at the source code (and maybe make an enhancement request), this deployment timestamp is calculated in class org.apache.maven.artifact.transform.SnapshotTransformation by the method getDeploymentTimestamp of the project maven-artifact-manager.

    The final version of the deployed artifact is calculated in method construcVersion : the SNAPSHOT is replaced by timestamp-buildNumber, where timestamp is the result of getDeploymentTimestamp and buildNumber is an increment.

    It should be possible to store this constructed version with System.setProperty("something", version); and then access it in the pom.xml with ${something}.

    0 讨论(0)
提交回复
热议问题