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 some unique, canonical ID e.g. 1.0-20080207-230803-1
.
As a result, invoking mvn deploy
produces artifacts whose canonical version cannot be determined before the mvn
executable is invoked.
Therefore, if one wishes to invoke any operations on the unique ID generated afterwards, one must try to extract the generated ID from the maven executable after mvn deploy
completes.
Is there any such mechanism to obtain the unique ID?
For example, mvn deploy
will produce the following output:
Uploading: https://oss.sonatype.org/content/repositories/snapshots/io/airlift/slice/0.11-SNAPSHOT/slice-0.11-20150220.165404-2.jar
But there seems to be no way to access the ID 0.11-20150220.165404-2
without parsing the output from Maven.
Example scenario: mvn build results in a new (unique) artifact being pushed to an internal repository manager. After that completes, we wish to push a notification over HTTP to inform some remote application of a new SNAPSHOT version of the application.
Although our repository manager allows us to query for the latest SNAPSHOT version, this is not the same as being able to pass absolute references to specific versions around.