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

3

6

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?

Diapositive answered 6/5, 2009 at 10:20 Comment(1)
Sorry to resurrect this old thread, but did you get this working? I can add the maven dependencies to the flex build path, but I get errors unless the SDK is in there too...Chiapas
D
2

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.

Diapositive answered 11/8, 2009 at 11:14 Comment(0)
H
1

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> 
Henriques answered 7/8, 2009 at 17:30 Comment(0)
I
1

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"/>
Industrialize answered 20/8, 2009 at 15:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.