How to add a build timestamp and version to a flex project
To do this you must be using maven 2.1 or later
Add in an additional property to your ant task, for example :
<plugin>
<executions>
<execution>
<configuration>
<tasks>
<ant antfile="${basedir}/build.xml" dir="${basedir}" target="flex">
....
<property name="maven.build.timestamp" value="${maven.build.timestamp}"/>
<property name="build.dir" location="${project.build.directory}"/>
....
</ant>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
in your pom, add in a formatter for the timestamp :
<project>
<properties>
<maven.build.timestamp.format>dd-MMM-yyyy HH:mm</maven.build.timestamp.format>
</properties>
......
</project>
withing your ant task, include in the properties defined in step.1
note the is a ' around the string fields, so its value="'${pom.version}'" not value="${pom.version}"
<mxmlc file="@{file}" fork="true" output="${build.dir}/${target_name.@{file}}@{outputFileSuffix}.swf">
.......
<define name="CONFIG::pom_version" value="'${pom.version}'"/>
<define name="CONFIG::build_time" value="'${maven.build.timestamp}'"/>
.......
</mxmlc>
the within flex use the CONFIG namespace get read the value of version and timestamp