Inject the Mercurial working directory changeset id such as (838cb9c0367e) into properties file via Maven?
You could make an update hook which outputs the changeset ID into an unversioned .properties file:
[hooks]
update = echo changesetid=$HG_PARENT1 > version.properties
Advantage of this approach is that you can easily customize this value if needed, and the build stays independent of the versioning system (or lack thereof).
If you want to put something in the Maven build that generates it instead, have you looked at the Buildnumber Maven Plugin (hgchangeset goal) or Maven Mercurial Build Number Plugin?
Merge this to your pom.xml
:
<project>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>hgchangeset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Then make a .properties
file in src/main/resources
with a property set as ${changeSet}
. For example:
revision = ${changeSet}
modificationTime = ${changeSetDate}