Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add maven dependencies to the flex build path in Flex Builder 3?

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?

like image 706
slashnick Avatar asked May 06 '09 10:05

slashnick


3 Answers

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.

like image 74
slashnick Avatar answered Oct 25 '22 16:10

slashnick


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> 
like image 26
Rich Seller Avatar answered Oct 25 '22 14:10

Rich Seller


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"/>
like image 42
Martin Harrigan Avatar answered Oct 25 '22 16:10

Martin Harrigan