What we know:
When I build the flex project with the Flex Builder (i.e. without maven build), I can use the 'Project Properties > Flex Compiler > Additional Compiler Arguments' to pass some additional arguments, such as referring to services-config.xml file:
In above screenshot, I am passing these additional arguments, which make my SWF files capable to communicate with respective services: -services "C:\MyProject\WebRoot\WEB-INF\flex\services-config.xml" -locale en_US
What we are doing:
We are tasked to convert this flex project to a maven project. I have done that using flexmojos-maven-plugin 3.8. (I can't use any latest versions, long story.) It compiles successfully and generates the SWF files too. However, I don't know how to pass above additional arguments in the configuration of my flexmojos-maven-plugin.
Here is my working configuration in pom.xml:
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>3.8</version>
<extensions>true</extensions>
<configuration>
<sourceFile>Abc.mxml</sourceFile>
<debug>true</debug>
<storepass></storepass>
<output>${basedir}/target/Abc.swf</output>
</configuration>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>3.2.0.3958</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
Question:
Could anyone please suggest how I can pass my above mentioned additional compiler arguments in the plugin configuration above in pom.xml? Without that, the SWF file gets generated, but it cannot communicate with the service.
The flexmojos-maven-plugin provides option to define the services via the configuration node as follows:
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>3.8</version>
<extensions>true</extensions>
<configuration>
<sourceFile>Abc.mxml</sourceFile>
<debug>true</debug>
<storepass></storepass>
<output>${basedir}/target/Abc.swf</output>
<services>../MyProject/WebRoot/WEB-INF/flex/services-config.xml</services>
<contextRoot>/</contextRoot>
</configuration>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>3.2.0.3958</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
If you specify services, then you have to specify contextRoot as well.