Maven, Flex Mojos and Flash Builder 4 tip

Flash Builder, Maven, tips 'n tricks 3 Comments »

Here's a quick tip for those of you who are using Flash Builder 4's FlexUnit integration and also build with Maven and Flex Mojos.

When executing the unit tests of your library project or application, Flash Builder creates a FlexUnitApplication.mxml file in the root package of your main class path. This file is the test runner UI that gets compiled when the tests are run. The problem is that when you try to execute a Maven build on your project, the build will fail because the test runner UI will also get compiled.

A solution is to use the maven-clean-plugin in the build phase and configure it to delete the FlexUnitApplication.mxml file.

To use it, place the following xml in the "build/plugins" section of your Maven build file. You might need to change the "directory" setting to match your classpath.

XML:
  1. <plugin>
  2.     <artifactId>maven-clean-plugin</artifactId>
  3.     <configuration>
  4.         <filesets>
  5.             <fileset>
  6.                 <directory>src/main/actionscript</directory>
  7.                 <includes>
  8.                     <include>FlexUnitApplication.mxml</include>
  9.                 </includes>
  10.             </fileset>
  11.         </filesets>
  12.     </configuration>
  13. </plugin>

If you now execute a "mvn clean install" command, the file will be removed and the build should succeed.


Add to Bloglines - Digg This! - del.icio.us - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner
 
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in