We're using maven to build a flex project using flex-mojo's, which is great. The problem is I can't add the swc dependencies specified in the pom to the flex build path. As far as I can see Flex Builder only lets you use an absolute path, so it can't see the maven dependencies even when using the m2eclipse plugin to add maven support.
Has anyone found a way to build with both maven and Flex Builder without duplicating the dependencies?
Flex-mojos now supports doing this using the flexmojos:flexbuilder
goal. It's not perfect for nested projects but seems to work well in all other cases.
This is not a particularly elegant answer, but it may serve your purposes.
You can use the maven-dependency-plugin to output the classpath to a file. The build-classpath is the relevant goal. the configuration below will output Maven's classpath to [project directory]/target/.mavenClasspath
You could write a small script or ant task to read the .mavenClasspath file contents and append the entries to the Eclipse .classpath. If you make the script a bit smarter and remove previous entries, then set it up as an external builder, you have a nearly integrated solution.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>output-classpath</id>
<phase>package</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<outputFile>${project.build.directory}.mavenClasspath</outputFile>
</configuration>
</execution>
</executions>
</plugin>
Flex Builder can now handle relative paths (see bug report); you can add them to your .actionScriptProperties as follows:
<libraryPathEntry kind="3" linkType="1" path="${M2_HOME}/repository/flexlib/flexlib/2.4/flexunit-2.4.swc" useDefaultLinkType="false"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With