Skip to content
Browse files

FLUME-702: Make git hash an argument to the build

The buildnumber plugin fails when attempting to build from a non git repo. This
allows the user to specify a git hash via a -Dbuild.revision argument at the maven
command line.
  • Loading branch information...
1 parent e7cfcb7 commit 660eb413062c2fd8123184f77fbe0b35d45c0370 @tucu00 tucu00 committed with jmhsieh
Showing with 9 additions and 26 deletions.
  1. +9 −26 flume-core/pom.xml
View
35 flume-core/pom.xml
@@ -12,6 +12,9 @@
<name>Flume Core</name>
<artifactId>flume-core</artifactId>
+ <properties>
+ <build.revision>NOT AVAILABLE</build.revision>
+ </properties>
<build>
<plugins>
@@ -35,26 +38,6 @@
</dependency>
</dependencies>
</plugin>
- <!-- this breaks if not in git repo. commented out until resolved -->
- <!--
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cloudera-buildnumber-maven-plugin</artifactId>
- <version>1.0-beta-5</version>
- <configuration>
- <fullGitRev>true</fullGitRev>
- <timestampFormat>{0, date, E MMM dd HH:mm:ss z yyyy}</timestampFormat>
- </configuration>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
@@ -62,6 +45,10 @@
<executions>
<execution>
<id>generate-version-file</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
<configuration>
<target>
<copy
@@ -70,18 +57,14 @@
<fileset dir="${basedir}/src/main/version" />
<filterset begintoken="%" endtoken="%">
<filter token="VERSION" value="${project.version}" />
- <filter token="REV" value="${buildNumber}" />
+ <filter token="REV" value="${build.revision}" />
<filter token="USER" value="${user.name}" />
- <filter token="DATE" value="${timestamp}" />
+ <filter token="DATE" value="${maven.build.timestamp}" />
<filter token="URL" value="${project.scm.url}" />
</filterset>
</copy>
</target>
</configuration>
- <phase>generate-sources</phase>
- <goals>
- <goal>run</goal>
- </goals>
</execution>
</executions>
</plugin>

0 comments on commit 660eb41

Please sign in to comment.
Something went wrong with that request. Please try again.