如何将 Maven 依赖项添加到 Flex Builder 3 中的 Flex 构建路径?

发布于 2024-07-19 04:35:21 字数 380 浏览 5 评论 0原文

我们使用 maven 来使用 flex-mojo 构建一个 Flex 项目,这非常棒。 问题是我无法将 pom 中指定的 SWC 依赖项添加到 Flex 构建路径中。 据我所知,Flex Builder 只允许您使用绝对路径,因此即使使用 m2eclipse 插件 添加 Maven 支持。

有没有人找到一种使用 Maven 和 Flex Builder 进行构建而不重复依赖项的方法?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

抚笙 2024-07-26 04:35:21

Flex-mojos 现在支持使用 <代码>flexmojos:flexbuilder目标。 它对于嵌套项目来说并不完美,但似乎在所有其他情况下都能很好地工作。

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.

半城柳色半声笛 2024-07-26 04:35:21

这不是一个特别优雅的答案,但它可能符合您的目的。

您可以使用 maven-dependency-plugin 将类路径输出到文件。 build-classpath 是相关目标。 下面的配置将把 Maven 的类路径输出到 [项目目录]/target/.mavenClasspath

您可以编写一个小脚本或 ant 任务来读取 .mavenClasspath 文件内容并将条目附加到 Eclipse .classpath。 如果您使脚本更加智能并删除以前的条目,则将其设置为 外部构建器,您拥有一个近乎集成的解决方案。

<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> 

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> 
指尖上得阳光 2024-07-26 04:35:21

Flex Builder 现在可以处理相对路径(请参阅错误报告); 您可以将它们添加到您的 .actionScriptProperties 中,如下所示:

<libraryPathEntry kind="3" linkType="1" path="${M2_HOME}/repository/flexlib/flexlib/2.4/flexunit-2.4.swc" useDefaultLinkType="false"/>

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"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文