I'd like to call
mvn clean install -Dsomeproperty=1.2.3-20110526-1836
to get
artifact-1.2.3-20110526-1836.jar
instead of
artifact-1.2.3-SNAPSHOT.jar
How can I pass that timestamp to maven ??
I'd like to call
mvn clean install -Dsomeproperty=1.2.3-20110526-1836
to get
artifact-1.2.3-20110526-1836.jar
instead of
artifact-1.2.3-SNAPSHOT.jar
How can I pass that timestamp to maven ??
The following artifact setting in pom.xml seem to be doing what you want:
<groupId>testgroup</groupId>
<artifactId>testartifact</artifactId>
<version>${someproperty}</version>
Now if you execute "mvn clean install -Dsomeproperty=1.1.timestamp", the jar file produced also contains the timestamp in its name.
I'm not sure if this is what you are looking for.
EDIT
Another solution since the pom file cannot be changed.
Execute the "mvn clean install" command normally. This generates a jar file like artifact-1.2.3-SNAPSHOT.jar.
Install this file again - this time with "mvn install:install-file -Dfile=artifact-1.2.3-SNAPSHOT.jar -DgroupId=testgroup -DartifactId=testartifact -Dversion=1.2.3-123456-1234 -Dpackaging=jar. This will install artifact-1.2.3-123456-1234.jar in your local repository
While this will do what you specified:
<project ...>
<properties>
<someproperty>somproperty-default-value</someproperty>
</properties>
<build>
<finalName>artifact-${someproperty}</finalName>
....
</build>
....
</project>
I would recommend to use this: How do I add time-stamp information to Maven artifacts?
The fastest hack for this is to run
mvn clean install --offline
This will prevent from loading your nightly build from remote repos.
You may also play with settings.xml