Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Flex Application (SWF files) are usually run on web context (WAR project). So is necessary to copy SWF files (and all runtime dependencies) into the WAR during packing phase. That is exactly what copy-flex-resources goal does.

Code Block
languagehtml/xml
<build>
   ...
      <plugins>
      ...
         <plugin>
            <groupId>net.flexmojos.oss</groupId>
            <artifactId>flexmojos-maven-plugin</artifactId>
            <executions>
               <execution>
                  <goals>
                     <goal>copy-flex-resources</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
</build>

Then, is necessary to add a dependency to all SWF. Like this:

Code Block
xml
xml
...
<dependencies>
   <dependency>
      <groupId>org.sonatype</groupId>
      <artifactId>swf-project</artifactId>
      <version>1.0</version>
      <type>swf</type>
   </dependency>
</dependencies>

Do not forget to declare type as swf.

What this goal does:

  1. copy all dependencies type SWF declared on project.
  2. copy any RSLs required by SWF (don't forget to generate optimized libraries on each SWC)
  3. copy runtime locales (only when the project is compiled by flexmojos and uses runtimeLocales configuration)
Warning

If you are having unexplained NullPointerExceptions during the build of your war project, this might be a combination of a Flexmojos and a Maven problem. There is an issue with Maven 3.0.3 (and newer) and the scopes (rsl, caching, ...) and packaging types (swf, swc) of Flexmojos. The copy maven resources target usses default Maven functionality to check if there are any "finalName" settings for the referenced swf-resources. Unfortunately the packaging of these swf-modules causes Maven to return null instead of a maven model. This causes the NullPointerException. One solution, if you don't use finalName, is to set an additional config parameter "<useFinalName>false</useFinalName>". This simply skips the entire functionality that seems to be broken.