Saturday, October 11, 2008

Flex-Mojos and working with modules

overview : I have several maven modules, maven java module - consists of java domain, and persistance, maven flex module - consists of actionscript files, and mxml, and any other supporting flex artifacts, maven web module- any related java, jsp, js, html, and anything responsible for packaging. I have one main application consisting of the shell, and several modules built in the same flex project. I assume , this is pretty standard setup, or something similar. So when packaging war. Using maven copy-dependencies plugin, we are able to copy the swf file as a dependency into the war.
- When maven compiles the flex package, it creates the main swf .. ex. flexapp.swf, and additional modules ex. flexmod1.swf . This gets created and installed in maven under the same group and artifact and id.
Took some time to figure out when packaging the war how to include all swf files in the war.

- this includes the main compiled swf


<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mainproj</artifactId>
<version>${project.version}</version>
<type>swf</type>
</dependency>



- to include the compiled modules


<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mainproj</artifactId>
<version>${project.version}</version>
<type>swf</type>
<classifier>nameofmodule</classifier>
</dependency>



use the classifier to specify the name of the compiled module.