Timestamp Version From Mvn To Flex

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 :

                       <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}"/>



in your pom, add in a formatter for the timestamp :

        <maven.build.timestamp.format>dd-MMM-yyyy HH:mm</maven.build.timestamp.format>


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}'"/>


the within flex use the CONFIG namespace get read the value of version and timestamp

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License