1

我正在将使用 Adob​​e Flex 4.6 和 FlexMojos 4 的应用程序迁移到 Apache Flex 4.14 和 FlexMojos 7。当我尝试执行“mvn build”时,出现此错误:

[ERROR]     Unresolveable build extension: Plugin net.flexmojos.oss:flexmojos-maven-plugin:7.0.1 or one of its dependencies could not be resolved:
The following artifacts could not be resolved:
org.apache.flex.compiler:mxmlc:jar:4.12.1.20140427, 
org.apache.flex.compiler:digest:jar:4.12.1.20140427, 
org.apache.flex.compiler:optimizer:jar:4.12.1.20140427, 
org.apache.flex.compiler:asdoc:jar:4.12.1.20140427, 
org.apache.flex.compiler:swcdepends:jar:4.12.1.20140427, 
org.apache.flex:compiler:pom:4.12.1.20140427: Failure to find 
org.apache.flex.compiler:mxmlc:jar:4.12.1.20140427 in 
http://repository.sonatype.org/content/groups/flexgroup/ was cached in the local repository, resolution will not be reattempted until the update interval of flex-mojos-repository has elapsed or updates are forced -> [Help 2]
[ERROR]     Unknown packaging: swf @ line 5, column 13

这是我的 pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.cognifit.cognifitSocialFlex</groupId>
    <artifactId>FlexCognifit</artifactId>
    <packaging>swf</packaging>
    <name>cognifitSocialFlex</name>
    <version>11.0.2.10</version>

    <properties>
        <flex.version>4.14.1.20150325</flex.version>
        <flashplayer.version>11.1</flashplayer.version>
    </properties>

    <build>
        <sourceDirectory>src</sourceDirectory>
        <directory>${project.basedir}/target/${project.version}</directory>
        <plugins>
            <plugin>
                <groupId>net.flexmojos.oss</groupId>
                <artifactId>flexmojos-maven-plugin</artifactId>
                <version>7.0.1</version>
                <extensions>true</extensions>
                <configuration>
                    <sourceFile>CpcSocialFlex.mxml</sourceFile>
                    <swfVersion>13</swfVersion>
                    <targetPlayer>11.1.0</targetPlayer>

                    <localesCompiled>
                        <locale>ar_MA</locale>
                        <locale>de_AT</locale>
                        <locale>de_CH</locale>
                        <locale>de_DE</locale>
                        <locale>el_GR</locale>
                        <locale>en_US</locale>
                        <locale>en_ZA</locale>
                        <locale>es_ES</locale>
                        <locale>es_MX</locale>
                        <locale>fr_FR</locale>
                        <locale>he_IL</locale>
                        <locale>it_IT</locale>
                        <locale>ja_JP</locale>
                        <locale>ko_KR</locale>
                        <locale>nl_NL</locale>
                        <locale>pt_BR</locale>
                        <locale>pt_PT</locale>
                        <locale>ru_RU</locale>
                        <locale>sr_RS</locale>
                        <locale>tr_TR</locale>
                        <locale>zh_CN</locale>
                        <locale>zh_HK</locale>
                    </localesCompiled>

                    <dependencies>
                        <dependency>
                            <groupId>org.apache.flex</groupId>
                            <artifactId>compiler</artifactId>
                            <version>${flex.version}</version>
                            <type>pom</type>
                        </dependency>
                    </dependencies>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.apache.flex</groupId>
            <artifactId>framework</artifactId>
            <version>${flex.version}</version>
            <type>pom</type>
        </dependency>

        <dependency>
            <groupId>com.adobe.flash.framework</groupId>
            <artifactId>playerglobal</artifactId>
            <version>${flashplayer.version}</version>
            <type>swc</type>
        </dependency>

        <dependency>
            <groupId>com.adobe.flex.framework.themes</groupId>
            <artifactId>halo</artifactId>
            <type>swc</type>
            <scope>theme</scope>
            <version>${flex.version}</version>
        </dependency>
    </dependencies>
</project>

我正在使用 Maven 3.2.5 和 Java 1.6.0_14:

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T12:29:23-05:00)
Maven home: /usr/local/maven
Java version: 1.6.0_14, vendor: Sun Microsystems Inc.
Java home: /usr/java/jdk1.6.0_14/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.21.7-2.fc8xen", arch: "i386", family: "unix"

这些是我遵循的步骤:

我使用安装程序下载了 Apache Flex SDK:

  • Apache Flex SDK 4.14.1
  • 空气 18.0
  • 闪存播放器 18

在此处输入图像描述

我使用 Mavenizer 创建了这个 SDK 的 Maven 版本:

在此处输入图像描述

然后我在我的 /root/.m2/repository/ 文件夹中部署了 mavenized 版本,并使用 pom.xml 执行了 mvn compile。

4

1 回答 1

0

顺便说一句,与此同时,mavenizer 已经发展了很多……通过“.mvn/extensions.xml”文件使用 maven 扩展。这应该会自动下载、转换和安装您引用的 Flex/Flash/Air 资源。因此,要升级到下一个 Flex/Flash/Air 版本,只需引用一个新版本,插件将负责其余的工作(只要该版本实际存在)。在此处查看更多详细信息:https ://cwiki.apache.org/confluence/display/FLEX/Preparing+FDKs+for+Maven+builds (请特别注意章节:使用 flex-sdk-converter 准备 FDK 资源-maven 扩展)

于 2016-01-05T09:18:01.613 回答