I'm currently setting up a mecurial repository for my maven project.
This maven project consists of several modules. All modules have the same version when I create an install zip containing all created jars.
So far I have realised this using a property in the parent pom which the modules use when they are build. So far everything work quite nice and I have only one position to change when I want to change the version.
Now I got the ingenius (=weird) idea to use the mecurial branch name as the maven version.
I know I can get the current mercurial branch name using hg branch
. Using the exec maven plugin it should be possible to read it on any system (window/linux). Using this and writing it to a property file, I should be able to read it again using the property plugin
However I'm stuck at reading the branch name and writing it to a file:
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>hg</executable>
<arguments>
<argument>branch</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
Does one of you know how to solve this or has an genius different solution to get the mercurial branch name into the maven pom when building?
Best regards, Xeno Lupus