|
BuildNumber
Extract SVN revision number into the build number string
IntroductionThis component makes it easy to incorporate the current SVN revision number into the built Java artifact. It can be used as:
The component looks at the source directory specified by the user and creates the file in the Java Properties format that contains the information requested. See below for the format. The component uses the "svnversion" command and assumes that the command-line Subversion client is installed. Input
Outputbuildnumber creates file named "buildnumber.properties" in the directory specified by the user. The file has the following format: build.number=<SVN-revision-number> build.modified=<modified> build.timestamp=<yymmdd-hhmm> Where
Maven Plugin Example<project>
<pluginRepositories>
<pluginRepository>
<id>codebistro-repo</id>
<name>codebistro repo</name>
<layout>default</layout>
<url>http://codebistro.googlecode.com/svn/repo/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.codebistro.tools</groupId>
<artifactId>buildnumber</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>generate-resources</goal>
</goals>
</execution>
</executions>
<configuration>
<outputPath></outputPath>
<basedir>...</basedir>
<buildDirectory>${project.build.directory}</buildDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>Ant Task ExampleAssume you downloaded the latest version of the jar from the repository to say ${basedir}/build.support/buildnumber.jar . <target name="init">
<taskdef name="svnbuildnumber" classname="org.codebistro.tools.BuildNumberTask" classpath="${basedir}/build.support/buildnumber.jar"/>
</target>
...
<target name="build"" />
<svnbuildnumber baseDir="${basedir}/sec" outputPath="${basedir}/build/classes/buildnumber.properties"/>
</target>
|
► Sign in to add a comment