【问题标题】:maven flex build failedmaven flex 构建失败
【发布时间】:2017-02-03 14:26:01
【问题描述】:

我正在尝试在 Eclipse 中构建一个包含 2 个模块的 maven 项目,一个是 java 代码,另一个是 flex 代码。

安装的maven版本是3.3.9,jdk是jdk7_u80。

maven install -X 命令给了我以下错误:

[DEBUG] 查找用于打包 swf 的生命周期映射 ClassRealm[项目>project.project:prjt-flex:01.00.00, 父:ClassRealm [maven.api,父:null]] [错误] 内部错误: java.lang.ClassCastException:java.lang.String 不能转换为 org.apache.maven.lifecycle.mapping.LifecyclePhase -> [帮助 1] org.apache.maven.InternalErrorException:内部错误: java.lang.ClassCastException:java.lang.String 不能转换为 org.apache.maven.lifecycle.mapping.LifecyclePhase 在 org.apache.maven.DefaultMaven.execute(DefaultMaven.java:121) 在 org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) 在 org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) 在 org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在 java.lang.reflect.Method.invoke(Method.java:606) 在 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 在 org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 在 org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 在 org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 引起:java.lang.ClassCastException:java.lang.String 不能 投射到 org.apache.maven.lifecycle.mapping.LifecyclePhase at

问题似乎来自 flex 模块,在 pom.xml 之后:

<properties>
        <flex.version>4.5.1.21328</flex.version>
        <template.dir>src/main/html-template</template.dir> 
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <flexmojos.version>4.0-RC2</flexmojos.version>      
    </properties>
    <build>
        <sourceDirectory>src/main/flex</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.sonatype.flexmojos</groupId>
                <artifactId>flexmojos-maven-plugin</artifactId>
                <version>${flexmojos.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <fullSynchronization>true</fullSynchronization>
                    <showWarnings>false</showWarnings>
                    <optimize>true</optimize>
                    <allowSourcePathOverlap>true</allowSourcePathOverlap>
                    <sourceFile>flexprojt.mxml</sourceFile>
                    <output>target/flexprojt.swf</output>                   
                    <localesCompiled>                       
                        <locale>en_US</locale>
                    </localesCompiled>
                    <includeStylesheets>
                        <stylesheet>
                            <name>style.css</name>
                            <path>assets/css</path>
                        </stylesheet>
                    </includeStylesheets>
                    <localesSourcePath>locale/{locale}</localesSourcePath>
                    <compilerSourcePath>
                        <path>src/main/flex</path>
                    </compilerSourcePath>
                    <rslUrls>
                        <rsl>{artifactId}_{version}.{extension}</rsl>
                    </rslUrls>
                    <targetPlayer>${flash.version}</targetPlayer>
                    <fonts>
                        <advancedAntiAliasing>true</advancedAntiAliasing>
                        <maxCachedFonts>20</maxCachedFonts>
                        <maxGlyphsPerFace>1000</maxGlyphsPerFace>
                        <managers>
                            <manager>flash.fonts.JREFontManager</manager>
                            <manager>flash.fonts.AFEFontManager</manager>
                            <manager>flash.fonts.BatikFontManager</manager> 
                            <manager>flash.fonts.CFFFontManager</manager>                           
                        </managers>
                    </fonts>
                    <modules>
                        <module>
                            <sourceFile>context.mxml</sourceFile>
                            <finalName>context</finalName>
                            <destinationPath>/</destinationPath>
                        </module>
                    </modules>
                </configuration>
                <executions> 
                    <execution> 
                        <goals> 
                            <goal>wrapper</goal> 
                        </goals> 
                        <configuration>
                            <templateURI>folder:html-template</templateURI>
                            <parameters> 
                                <swf>${project.build.finalName}</swf> 
                                <width>100%</width> 
                                <height>100%</height> 
                            </parameters>
                        </configuration> 
                    </execution> 
                </executions> 
                <dependencies>
                    <dependency>
                        <groupId>org.sonatype.flexmojos</groupId>
                        <artifactId>flexmojos-threadlocaltoolkit-wrapper</artifactId>
                        <version>${flexmojos.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.adobe.flex</groupId>
                        <artifactId>compiler</artifactId>
                        <version>${flex.version}</version>
                        <type>pom</type>
                    </dependency>
                    <dependency>
                        <groupId>com.adobe.flex.compiler</groupId>
                        <artifactId>flex-fontkit</artifactId>
                        <version>${flex.version}</version>
                        <type>jar</type>
                    </dependency>
                    <dependency>
                        <groupId>com.adobe.flex.compiler</groupId>
                        <artifactId>afe</artifactId>
                        <version>${flex.version}</version>
                        <type>jar</type>
                    </dependency>
                    <dependency>
                        <groupId>com.adobe.flex.compiler</groupId>
                        <artifactId>aglj40</artifactId>
                        <version>${flex.version}</version>
                        <type>jar</type>
                    </dependency>
                    <dependency>
                        <groupId>com.adobe.cairngorm</groupId>
                        <artifactId>cairngorm3</artifactId>
                        <version>3.0.21</version>
                        <type>pom</type>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>2.3.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.5</version>
            </plugin>
        </plugins>
    </build>

【问题讨论】:

    标签: java eclipse maven apache-flex


    【解决方案1】:

    我通过使用 maven 3.1.1 版本构建项目解决了这个问题。

    但我还是想用 3.3.9 版本构建它,我不知道我需要哪个版本的 flex 编译器。

    【讨论】:

    • 实际上我正在使用 3.9.9 构建我的 flex 项目,它的 flex 版本为 4.5.1.21328。之后我使用了 maven 3.1.1 并且问题解决了。你遇到了什么错误?
    • 得到与您在问题中所述的几乎相同的异常:[错误] 内部错误:java.lang.ClassCastException:java.lang.String 无法转换为 org.apache.maven.lifecycle.mapping。 LifecyclePhase -> [帮助 1]
    • 我尝试在 jenkins 中使用 maven 3.1.1 版本作为 maven 工具,但它不能解决这个问题并遇到同样的问题..
    • 您使用的是哪个版本的 flex?
    • 4.2-beta
    【解决方案2】:

    您应该让您的 IDE 使用您的外部安装(在您的操作系统上)版本的 maven,而不是使用其捆绑的 maven。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-26
      • 2021-07-02
      • 2014-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多