[MNG-5402] Better build number for git

Signed-off-by: Anders Hammar <anders@hammar.net>
This commit is contained in:
Anders Hammar 2012-12-05 14:21:04 +01:00
parent 19492b485a
commit f95ab2e7cd
3 changed files with 29 additions and 69 deletions

View File

@ -124,73 +124,33 @@
</models> </models>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<executions>
<execution>
<id>create-noncanonicalrev</id>
<goals>
<goal>create-timestamp</goal>
</goals>
<configuration>
<timestampFormat>'NON-CANONICAL_'yyyy-MM-dd_HH-mm_'${user.name}'</timestampFormat>
<timestampPropertyName>nonCanonicalRevision</timestampPropertyName>
</configuration>
</execution>
<execution>
<id>create-buildnumber</id>
<goals>
<goal>create</goal>
</goals>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<revisionOnScmFailure>${nonCanonicalRevision}</revisionOnScmFailure>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
<profiles>
<profile>
<id>svn-buildnumber</id>
<activation>
<file>
<exists>.svn</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>non-canonical-buildnumber</id>
<activation>
<file>
<missing>.svn</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<format>NON-CANONICAL_{0,date,yyyy-MM-dd_HH-mm}_{1}</format>
<items>
<item>timestamp</item>
<item>${user.name}</item>
</items>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -83,7 +83,7 @@ public final class CLIReportingUtils
if ( rev != null || timestamp != null ) if ( rev != null || timestamp != null )
{ {
msg += " ("; msg += " (";
msg += ( rev != null ? "r" + rev : "" ); msg += ( rev != null ? rev : "" );
if ( timestamp != null ) if ( timestamp != null )
{ {
SimpleDateFormat fmt = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ssZ" ); SimpleDateFormat fmt = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ssZ" );

View File

@ -398,7 +398,7 @@
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId> <artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version> <version>1.2</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>