I'm trying to add the buildnumber
maven plugin to include the hgchangeset
from mercurial. This works great for me when running in the Terminal (I'm on Mac OSX).
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
<goal>hgchangeset</goal> // The specific goal I'm interested in
<goal>create-timestamp</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<revisionOnScmFailure>true</revisionOnScmFailure>
<!-- format of the property 'buildNumber' -->
<format>{0,date,MMdd-HHmm}</format>
<items>
<item>timestamp</item>
</items>
</configuration>
</plugin>
</plugins>
However, when running in Eclipse and Jenkins, I get this error:
[INFO] EXECUTING: /bin/sh -c cd /Users/Shared/Jenkins/Home/jobs/proj/workspace && hg id -i
[ERROR]
EXECUTION FAILED
Execution of cmd : id failed with exit code: 127.
Working directory was:
/Users/Shared/Jenkins/Home/jobs/proj/workspace
Your Hg installation seems to be valid and complete.
Hg version: NA (OK)
Logging into that server as the user 'jenkins', I can execute: hg id -i
just fine and I see the correct output, as the hg
binary is on my $PATH
and that's recognized in the console.
Similarly, Eclipse gives the same output. I imagine this is because in Terminal the maven build can see my hg
binary in /usr/local/bin
but Eclipse and Jenkins cannot.
Is there any way I can tell Maven to use hg
at that location? I don't care if it has to be hardcoded since the binary location is the same on all our computers.
Thanks in advance
echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin