- BUILD_NUMBER
- SVN_REVISION
Alas there is no decent maven plugin out there to write environment variables out to a file. I found the following plugins out there but none of them (+/-) did the trick.
You can resort to usind the ant plugin inside Maven to do a macro-style replace technique. You can read more about it here.
Or the best way is to have a template file (+-) and leverage Maven model like this (+-)
<?xml version="1.0" encoding="UTF-8"?>
<root>
<buildNumber>${buildNumber}</buildNumber>
<svnRevisionNumber>${svnRevision}</svnRevisionNumber>
</root>
<root>
<buildNumber>${buildNumber}</buildNumber>
<svnRevisionNumber>${svnRevision}</svnRevisionNumber>
</root>
<project >
...
<!-- Map the values provided by the Hudson build to local variables -->
<properties>
<buildNumber>${BUILD_NUMBER}</buildNumber>
<svnRevision>${SVN_REVISION}</svnRevision>
</properties>
...
<build>
...
<!-- Update version.xml file with the versioning data -->
<resources>
<resource>
<targetPath>${project.build.directory}/${project.artifactId}-${project.version}</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes><include>version.xml</include></includes>
</resource>
</resources>
...
<build>
...
<project >
...
<!-- Map the values provided by the Hudson build to local variables -->
<properties>
<buildNumber>${BUILD_NUMBER}</buildNumber>
<svnRevision>${SVN_REVISION}</svnRevision>
</properties>
...
<build>
...
<!-- Update version.xml file with the versioning data -->
<resources>
<resource>
<targetPath>${project.build.directory}/${project.artifactId}-${project.version}</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes><include>version.xml</include></includes>
</resource>
</resources>
...
<build>
...
<project >
Also as a sidenote: The Hudson variables can be placed inside the manifest file if your artifact being built happens to be a war or jar file. Read more on that here.
Links:
Home / Using Flex 4 / Developer tools / Flex compilers / Using mxmlc, the application compiler / Passing Strings
How to configure flexmojos to pass in compile time variables:
gmail thread
official docs
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>system</goal>
</goals>
<configuration>
<output>${basedir}/src/locale/app.properties</output>
</configuration>
</execution>
</executions>
</plugin>