0

嗨,我是 Flex 的新手,正在研究 Flex 与 Flexmojos(Maven 插件)的集成,我尝试过集成,但在 Main.mxml 中编译时遇到了问题

s:应用程序无法解析为类型

我正在使用 Flex SDK 4.6,我阅读了一些解决方案,指定检查命名空间并检查我的 SDK 版本,一切都很好。即使 mx:Application 返回相同的错误。

有没有人遇到过这样的问题,请指教!

谢谢。

--编辑

这是代码

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" currentState="loginState"
               backgroundColor="#788E99" xmlns:Mxmls="Mxmls.*"
               creationComplete="siteData.send()">
    <fx:Declarations>
        <mx:HTTPService url="assets/content.xml" id="siteData" resultFormat="e4x"/> 
    </fx:Declarations>

    <!-- <fx:Style source="../Cat-Clv.css">
    </fx:Style>-->

    <fx:Declarations>
        <fx:XMLList id="mainMenuXMLList">
            <menuitem id="adminmenu" label="{resourceManager.getString('resources','menubar.admin')}" data="admin" percentWidth="12.5" visible="false">

代码是这样开始的。pom文件

<?xml version="1.0" encoding="UTF-8"?>

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

    <parent>
        <artifactId>abc</artifactId>
        <groupId>abc.abc.abc</groupId>
        <version>0.7</version>
    </parent>

    <groupId>abc.abc.abc.swf</groupId>
    <artifactId>abc-swf</artifactId>
    <version>0.3</version>
    <packaging>swf</packaging>

    <name>swf Application</name>

    <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> <dependencies> <dependency> <groupId>com.adobe.flex</groupId> 
                    <artifactId>compiler</artifactId> <version>3.2.0.3958</version> <type>pom</type> 
                    </dependency> </dependencies> -->
                <dependencies>
                    <dependency>
                        <groupId>com.adobe.flex</groupId>
                        <artifactId>compiler</artifactId>
                        <version>4.6.b.23201</version>
                        <type>pom</type>
                    </dependency>
                </dependencies>
                <extensions>true</extensions>
                <configuration>
                    <iKnowWhatImDoingPleaseBreakMyBuildIwontBlameFlexmojosForStopWorking>true</iKnowWhatImDoingPleaseBreakMyBuildIwontBlameFlexmojosForStopWorking>

                    <locales>
                        <locale>en_US</locale>
                        <locale>fr_FR</locale>
                    </locales>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!-- <dependency> <groupId>com.adobe.flex.framework</groupId> <artifactId>flex-framework</artifactId> 
            <version>3.2.0.3958</version> <version>3.4.0.9271</version> <type>pom</type> 
            </dependency> -->

        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>framework</artifactId>
            <version>4.6.b.23201</version>
            <type>swz</type>
        </dependency>

        <!-- <dependency> <groupId>com.adobe.flex.framework</groupId> <artifactId>flex-framework</artifactId> 
            <version>3.4.0.9271</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>

        <dependency>
            <groupId>com.cat.clv.swc</groupId>
            <artifactId>clv-swc</artifactId>
            <version>0.3</version>
            <type>swc</type>
        </dependency>
    </dependencies>

    <profiles>
        <profile><!--https://docs.sonatype.org/pages/viewpage.action?pageId=2949459 -->
            <id>m2e</id>
            <activation>
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.maven.ide.eclipse</groupId>
                        <artifactId>lifecycle-mapping</artifactId>
                        <version>0.9.9-SNAPSHOT</version>
                        <configuration>
                            <mappingId>customizable</mappingId>
                            <configurators>
                                <configurator
                                    id='org.maven.ide.eclipse.configuration.flex.configurator' />
                            </configurators>
                            <mojoExecutions>
                                <mojoExecution>org.apache.maven.plugins:maven-resources-plugin::</mojoExecution>
                            </mojoExecutions>
                        </configuration>
                    </plugin>
                </plugins>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-resources-plugin</artifactId>
                            <version>2.4</version>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>
</project>
4

1 回答 1

1

这意味着 spark.swc 不包含在您的 swf 中,这是我配置 FlexMojo 的方式:

<configuration>
   <flashplayer.version.swf>13</flashplayer.version.swf>
   <sourceFile>org/htulipe/MyApp.mxml</sourceFile>          
</configuration> 

以下是我声明 Flash 依赖项的方式:

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

    <dependency> 
        <groupId>com.adobe.flex.framework</groupId> 
        <artifactId>playerglobal</artifactId> 
        <version>${flex.sdk.version}</version>
        <classifier>${flex.player.version.major}.${flex.player.version.minor}</classifier>
        <type>swc</type>
    </dependency> 

    <dependency>
        <groupId>com.adobe.flexunit</groupId>
        <artifactId>flexunit</artifactId>
        <version>4.0-rc-1</version>
        <type>swc</type>
        <scope>test</scope>
    </dependency>
</dependencies>

希望它可能会有所帮助。另外,我建议不要将 iKnowWhatImDoingPleaseBreakMyBuildIwontBlameFlexmojosForStopWorking 选项设置为 true。该选项的名称非常雄辩。:)

于 2012-11-05T14:37:52.947 回答