Publish compiled Flex application and other resources to directory in Maven?

415 views Asked by At

I just got all set up and compiling in Maven with Flex-Mojos, and now my next question is how I would "publish" my compiled application to an arbitrary directory along with its web resources. It has a few PHP scripts which need to be copied, as well as the html wrapper of course. If I were to do this in Ant (which is where I'm coming from), I would do the following:

<copy todir="${deploy.dir}">
    <fileset file="${compiled.swf.file}"/>
    <fileset dir="${web.dir}" includes="**/*"/>
</copy>

Since this is Maven and the approach to project management is very different, what should I do to accomplish this? I need a fairly easy way to test my application (not unit-test, mind you) in a browser, what should I do?

2

There are 2 answers

0
Naftuli Kay On BEST ANSWER

Ended up using the Maven Ant runner to do it in the copy-resources phase.

3
BennyMcBenBen On

On my project, I have the HTML wrapper file in a war project under src/main/resources. Then I used the Dependency Plugin to copy the SWF to the WAR. Here's an example:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>${maven-dependency-plugin.version}</version>
    <executions>
      <execution>
        <id>unpack-swf</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>copy-dependencies</goal>
        </goals>
        <configuration>              
          <outputDirectory>${project.build.directory}/<your-project-name></outputDirectory>
        </configuration>
      </execution>
    </executions>
  </plugin>

Here's an example dependency:

        <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId><your-swf-artifact></artifactId>
        <version>${project.version}</version>
        <type>swf</type>
    </dependency>