Question

I have two Maven projects: one to build a SWF and another one to build a WAR that contains it. The WAR needs to contain a Flash wrapper for the SWF. Flexmojos is apparently capable of doing this via the HTML wrapper mojo, but this doesn't work with Maven 3. See here for more details.

Is there a workaround for this?

My SWF POM has the following:

<plugin>
    <groupId>org.sonatype.flexmojos</groupId>
    <artifactId>flexmojos-maven-plugin</artifactId>
    <version>4.1-beta</version>
    <configuration>
        <parameters>
            <swf>${project.artifactId}-${project.version}</swf>
            <title>My application title</title>
            <width>100%</width>
            <height>100%</height>
            <bgcolor>#ffffff</bgcolor>
        </parameters>
    </configuration>
</plugin>

and my WAR POM has the following:

<plugin>
    <groupId>org.sonatype.flexmojos</groupId>
    <artifactId>flexmojos-maven-plugin</artifactId>
    <version>4.1-beta</version>
    <extensions>true</extensions>

    <executions>
        <execution>
            <id>wrapper</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>wrapper</goal>
            </goals>
            <configuration>
                <wrapperArtifact>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>the-swc-project</artifactId>
                    <version>${project.version}</version>
                </wrapperArtifact>
                <htmlName>index</htmlName>
            </configuration>
        </execution>
        <execution>
            <goals>
                <goal>copy-flex-resources</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Was it helpful?

Solution

Upon further investigation, I discovered that the problem here is that Flexmojos tries to reconfigure the WAR plugin, but it does so in a way that doesn't work with Maven 3.

The fairly grim workaround that I found involved manually configuring the WAR plugin as follows:

<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
        <warSourceExcludes>index.template.html</warSourceExcludes>
        <webResources>
            <resource>
                <directory>target/war/work/wrapped-template</directory>
            </resource>
        </webResources>
   </configuration>
</plugin>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top