【问题标题】:How to compile maven/flex project without any *.mxml file?如何在没有任何 *.mxml 文件的情况下编译 maven/flex 项目?
【发布时间】:2010-12-13 16:18:41
【问题描述】:

有什么方法可以编译不包含任何 *.mxml 的 maven/flex 项目? flex 项目仅包含 ActionScript 类(即“src/flex”目录仅包含 *.as 文件)。我的 pom.xml 在这里:

<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<name>test</name>
<packaging>swf</packaging>
<build>
    <sourceDirectory>src/main/flex</sourceDirectory>
    <testSourceDirectory>src/test/flex</testSourceDirectory>
    <plugins>
        <plugin>
            <groupId>org.sonatype.flexmojos</groupId>
            <artifactId>flexmojos-maven-plugin</artifactId>
            <version>3.8</version>
            <extensions>true</extensions>
            <dependencies>
                <dependency>
                    <groupId>com.adobe.flex</groupId>
                    <artifactId>compiler</artifactId>
                    <version>4.5.0.18623</version>
                    <type>pom</type>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>com.adobe.flex.framework</groupId>
        <artifactId>flex-framework</artifactId>
        <version>4.5.0.18623</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>com.adobe.flexunit</groupId>
        <artifactId>flexunit</artifactId>
        <version>0.85</version>
        <type>swc</type>
        <scope>test</scope>
    </dependency>
</dependencies>

“mvn package -e”抛出这个错误:

[ERROR] Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.8:compile-swf (default-compile-swf) on project test: Source file not expecified and no default found! -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.8:compile-swf (default-compile-swf) on project q-integra-scorecard-ldservice: Source file not expecified and no default found!

【问题讨论】:

    标签: actionscript-3 maven-2 flex4


    【解决方案1】:

    尝试将其添加到 中,其中“Main.as”是您的类:

    <configuration>
        <sourceFile>Main.as</sourceFile>
    </configuration>
    

    【讨论】:

      【解决方案2】:

      就我而言,我没有任何主要源文件(它是一个充满接口类的 SWC,如 ISessionProxy.as)。

      所以我必须做两件事才能让它发挥作用:

      1) 引用我的源目录(在构建标签下):

      <build>
          <sourceDirectory>src/main/flex</sourceDirectory>
      

      2) 遵循我找到的on this mail groupthe FlexMojos Google Group 的建议:

      "...只需删除您的 pom 上的所有依赖项,因为这些依赖项 已经在超级 pom 上定义了。”

      所以,我删除了所有依赖项并将它们一一添加回来,直到我得到它来编译。我只需要:

      <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>flex-framework</artifactId>
          <version>${flex.sdk.version}</version>
          <type>pom</type>
      </dependency>
      

      我什至删除了 FlexMojos 插件的所有依赖项:

      <plugin>
          <groupId>org.sonatype.flexmojos</groupId>
          <artifactId>flexmojos-maven-plugin</artifactId>
          <version>${flexmojos.version}</version>
          <configuration>
                  <targetPlayer>${flash.player.version}</targetPlayer>
          </configuration>
      </plugin>
      

      这对我有用,生成了我需要的 SWC,我希望它也可以帮助其他人!

      【讨论】:

        猜你喜欢
        • 2023-03-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-09-20
        • 1970-01-01
        • 2023-03-16
        • 1970-01-01
        • 2012-10-23
        相关资源
        最近更新 更多