Skip to content

Instantly share code, notes, and snippets.

@smat
Created February 22, 2012 15:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smat/1885635 to your computer and use it in GitHub Desktop.
Save smat/1885635 to your computer and use it in GitHub Desktop.
Commit id in production
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<!-- outputFile doesn't work in the regular v1.2 (see MEXEC-86) -->
<version>1.2.1-BRING</version>
<executions>
<execution>
<id>git-revision</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>bash</executable>
<arguments>
<argument>${project.basedir}/revision.sh</argument>
</arguments>
<outputFile>${project.basedir}/src/main/webapp/revision.txt</outputFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
#!/bin/bash
BRANCHES=$(git show -s --pretty=%d HEAD)
REVISION=$(git log --format=format:"%H %ci" -1)
echo "$REVISION $BRANCHES"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment