Could not resolve <fx:Script> to a component implementation

3.1k views Asked by At

i created project with flexmojos maven archtype..i used flexmojos:flexbuilder and compile/run with FlashBuilder 4 everything is okay but when i try to compile project with flexmojos i got following error:


[ERROR] Z:....\src\main\flex\Main.mxml:[6,-1] Could not resolve < fx:Script > to a component implementation.

[INFO] BUILD FAILURE


my mxml:

<?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" 
                                width="100%" height="100%" 
creationComplete="application1_creationCompleteHandler(event)"> 
        <fx:Script> 
                <![CDATA[ 
                        import mx.controls.Alert; 
                        import mx.events.FlexEvent; 
                        protected function 
application1_creationCompleteHandler(event:FlexEvent):void 
                        { 
                                Alert.show("success!!!!") 
                        } 
        ]]></fx:Script> 
</s:Application> 

pom.xml like:

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

    <groupId>com.foo</groupId>
    <artifactId>Bar</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>swf</packaging>

    <name>Foobar</name>

    <properties>
        <flex-sdk.version>4.1.0.16076</flex-sdk.version>
        <flex-sdk.scope>compile</flex-sdk.scope>
        <flexmojos.version>3.8</flexmojos.version>
        <player.version>10.0</player.version>
    </properties>
    <pluginRepositories>
        <!--
            Required for regular plugin use until moved over to Maven central
            repo.
        -->
        <pluginRepository>
            <id>flex-mojos-plugin-repository</id>
            <url>http://repository.sonatype.org/content/groups/flexgroup/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>

        <!-- Required for building plugin from source. -->
        <pluginRepository>
            <id>flex-mojos-internal-plugins-repository</id>
            <url>http://repository.sonatype.org/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>


    <repositories>
        <!--
            Required for regular plugin use until moved over to Maven central
            repo.
        -->
        <repository>
            <id>flex-mojos-repository</id>
            <url>http://repository.sonatype.org/content/groups/flexgroup/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>

        <!-- Required for building plugin from source. -->
        <repository>
            <id>flex-mojos-internal-repository</id>
            <url>http://repository.sonatype.org/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>apache-internal-repository</id>
            <url>https://repository.apache.org/content/repositories/maven-014/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    <build>
        <sourceDirectory>src/main/flex</sourceDirectory>
        <testSourceDirectory>src/test/flex</testSourceDirectory>
        <plugins>

            <plugin>
                <groupId>org.sonatype.flexmojos</groupId>
                <artifactId>flexmojos-maven-plugin</artifactId>
                <version>${flexmojos.version}</version>
                <extensions>true</extensions>

                <dependencies>
                    <dependency>
                        <groupId>com.adobe.flex</groupId>
                        <artifactId>compiler</artifactId>
                        <version>${flex-sdk.version}</version>
                        <type>pom</type>
                    </dependency>
                </dependencies>
                <configuration>
                    <accessible>false</accessible>
                    <targetPlayer>${player.version}</targetPlayer>
                    <incremental>false</incremental>
                    <debug>false</debug>
                    <locale>en_US</locale>
                    <optimize>true</optimize>
                    <showWarnings>true</showWarnings>
                    <strict>true</strict>
                    <useNetwork>true</useNetwork>
                    <allowSourcePathOverlap>true</allowSourcePathOverlap>
                    <sourcePaths>
                        <path>${basedir}/src/main/flex</path>
                    </sourcePaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-config</id>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!-- Flex framework resource bundles -->
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>playerglobal</artifactId>
            <version>${flex-sdk.version}</version>
            <type>swc</type>
            <classifier>${player.version}</classifier>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>playerglobal</artifactId>
            <version>${flex-sdk.version}</version>
            <type>rb.swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>textLayout</artifactId>
            <version>${flex-sdk.version}</version>
            <type>swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>osmf</artifactId>
            <version>${flex-sdk.version}</version>
            <type>swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>framework</artifactId>
            <version>${flex-sdk.version}</version>
            <type>swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>spark</artifactId>
            <version>${flex-sdk.version}</version>
            <type>swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>sparkskins</artifactId>
            <version>${flex-sdk.version}</version>
            <type>swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>rpc</artifactId>
            <version>${flex-sdk.version}</version>
            <type>swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>datavisualization</artifactId>
            <version>${flex-sdk.version}</version>
            <type>swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>flash-integration</artifactId>
            <version>${flex-sdk.version}</version>
            <type>swc</type>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>flex</artifactId>
            <version>${flex-sdk.version}</version>
            <type>swc</type>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>framework</artifactId>
            <version>${flex-sdk.version}</version>
            <type>zip</type>
            <classifier>configs</classifier>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>utilities</artifactId>
            <version>${flex-sdk.version}</version>
            <type>swc</type>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>datavisualization</artifactId>
            <version>${flex-sdk.version}</version>
            <type>rb.swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>flash-integration</artifactId>
            <version>${flex-sdk.version}</version>
            <type>rb.swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>framework</artifactId>
            <version>${flex-sdk.version}</version>
            <type>rb.swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>osmf</artifactId>
            <version>${flex-sdk.version}</version>
            <type>rb.swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>rpc</artifactId>
            <version>${flex-sdk.version}</version>
            <type>rb.swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>spark</artifactId>
            <version>${flex-sdk.version}</version>
            <type>rb.swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>textLayout</artifactId>
            <version>${flex-sdk.version}</version>
            <type>rb.swc</type>
            <scope>${flex-sdk.scope}</scope>
        </dependency>

</dependencies>

</project>

maven output compiler config :

INFO] Flex compiler configurations: 
-compiler.external-library-path C:\...\.m2\repository\com\adobe\flex 
\framework\playerglobal\4.1.0.16076\10.0\playerglobal.swc 
-compiler.include-libraries= 
-compiler.library-path C:\...\.m2\repository\com\adobe\flex\framework 
\datavisualization\4.1.0.16076\datavisualization-4.1.0.16076.swc C:\... 
\.m2\repository\com\adobe\flex\framework\flash-integration 
\4.1.0.16076\flash-integration-4.1.0.16076.swc C:\...\.m2\repository 
\com\adobe\flex\framework\flex\4.1.0.16076\flex-4.1.0.16076.swc C:\... 
\.m2\repository\com\adobe\flex\framework\framework 
\4.1.0.16076\framework-4.1.0.16076.swc C:\...\.m2\repository\com\adobe 
\flex\framework\osmf\4.1.0.16076\osmf-4.1.0.16076.swc C:\... 
\.m2\repository\com\adobe\flex\framework\rpc 
\4.1.0.16076\rpc-4.1.0.16076.swc C:\...\.m2\repository\com\adobe\flex 
\framework\spark\4.1.0.16076\spark-4.1.0.16076.swc C:\... 
\.m2\repository\com\adobe\flex\framework\sparkskins 
\4.1.0.16076\sparkskins-4.1.0.16076.swc C:\...\.m2\repository\com\adobe 
\flex\framework\textLayout\4.1.0.16076\textLayout-4.1.0.16076.swc C: 
\...\.m2\repository\com\adobe\flex\framework\utilities 
\4.1.0.16076\utilities-4.1.0.16076.swc C:\...\.m2\repository\com\adobe 
\flex\framework\datavisualization 
\4.1.0.16076\datavisualization-4.1.0.16076-en_US.rb.swc C:\... 
\.m2\repository\com\adobe\flex\framework\framework 
\4.1.0.16076\framework-4.1.0.16076-en_US.rb.swc C:\...\.m2\repository 
\com\adobe\flex\framework\osmf\4.1.0.16076\osmf-4.1.0.16076- 
en_US.rb.swc C:\...\.m2\repository\com\adobe\flex\framework\rpc 
\4.1.0.16076\rpc-4.1.0.16076-en_US.rb.swc C:\...\.m2\repository\com 
\adobe\flex\framework\spark\4.1.0.16076\spark-4.1.0.16076-en_US.rb.swc 
C:\...\.m2\repository\com\adobe\flex\framework\textLayout 
\4.1.0.16076\textLayout-4.1.0.16076-en_US.rb.swc C:\...\.m2\repository 
\com\adobe\flex\framework\flash-integration\4.1.0.16076\flash- 
integration-4.1.0.16076-en_US.rb.swc C:\...\.m2\repository\com\adobe 
\flex\framework\playerglobal\4.1.0.16076\playerglobal-4.1.0.16076- 
en_US.rb.swc 
-compiler.theme Z:\.....\target\classes\configs\themes\Spark 
\spark.css 
-compiler.accessible=true 
-compiler.allow-source-path-overlap=false 
-compiler.as3=true 
-compiler.debug=false 
-compiler.es=false 
-compiler.fonts.managers flash.fonts.JREFontManager 
flash.fonts.BatikFontManager flash.fonts.AFEFontManager 
flash.fonts.CFFFontManager 
-compiler.fonts.local-fonts-snapshot Z:\.....\target\classes 
\fonts.ser 
-compiler.keep-generated-actionscript=false 
-licenses.license flashbuilder4 952309948800588759250406 
-licenses.license flexbuilder4.displayedStartPageAtLeastOneTime true 
-compiler.locale en_US 
-compiler.optimize=true 
-compiler.source-path Z:\.....\src\main\flex 
-compiler.strict=true 
-use-network=true 
-compiler.verbose-stacktraces=false 
-compiler.actionscript-file-encoding UTF-8 
-target-player 10.0.0 
-default-background-color 8821927 
-default-frame-rate 24 
-default-script-limits 1000 60 
-default-size 500 375 
-compiler.headless-server=false 
-compiler.keep-all-type-selectors=false 
-compiler.use-resource-bundle-metadata=true 
-metadata.date Fri Mar 04 14:04:37 EET 2011 
-metadata.localized-title Main x-default 
-verify-digests=true 
-compiler.namespaces.namespace+=http://ns.adobe.com/mxml/2009,Z:\..... 
\target\classes\config-4.1.0.16076\mxml-2009-manifest.xml 
-compiler.namespaces.namespace+=library://ns.adobe.com/flex/spark,Z: 
\.....\target\classes\config-4.1.0.16076\spark-manifest.xml 
-compiler.namespaces.namespace+=library://ns.adobe.com/flex/mx,Z:\..... 
\target\classes\config-4.1.0.16076\mx-manifest.xml 
-compiler.namespaces.namespace+=http://www.adobe.com/2006/mxml,Z:\..... 
\PozitronUI\target\classes\config-4.1.0.16076\mxml-manifest.xml - 
static-link-runtime-shared-libraries=false -load-config= 
-metadata.language+=en_US 

any help...

regards,

1

There are 1 answers

4
Florian F On

Some dependencies are missing in your POM file. (framework, spark, sparkskins, ...) Here is an excerpt of ony of my project :

<dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>playerglobal</artifactId>
          <version>${flex.sdk.version}</version>
          <type>swc</type>
          <classifier>${flash.player.major}</classifier>
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>playerglobal</artifactId>
          <version>${flex.sdk.version}</version>
          <type>rb.swc</type>
          <scope>${flex.sdk.scope}</scope>
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>textLayout</artifactId>
          <version>${flex.sdk.version}</version>
          <type>swc</type>
          <scope>${flex.sdk.scope}</scope>                
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>osmf</artifactId>
          <version>${flex.sdk.version}</version>
          <type>swc</type>
          <scope>${flex.sdk.scope}</scope>                
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>framework</artifactId>
          <version>${flex.sdk.version}</version>
          <type>swc</type>
          <scope>${flex.sdk.scope}</scope>        
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>spark</artifactId>
          <version>${flex.sdk.version}</version>
          <type>swc</type>
          <scope>${flex.sdk.scope}</scope>        
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>sparkskins</artifactId>
          <version>${flex.sdk.version}</version>
          <type>swc</type>
          <scope>${flex.sdk.scope}</scope>        
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>rpc</artifactId>
          <version>${flex.sdk.version}</version>
          <type>swc</type>
          <scope>${flex.sdk.scope}</scope>
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>datavisualization</artifactId>
          <version>${flex.sdk.version}</version>
          <type>swc</type>
          <scope>${flex.sdk.scope}</scope>        
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>flash-integration</artifactId>
          <version>${flex.sdk.version}</version>
          <type>swc</type>
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>flex</artifactId>
          <version>${flex.sdk.version}</version>
          <type>swc</type>
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>framework</artifactId>
          <version>${flex.sdk.version}</version>
          <type>zip</type>
          <classifier>configs</classifier>
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>utilities</artifactId>
          <version>${flex.sdk.version}</version>
          <type>swc</type>
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>datavisualization</artifactId>
          <version>${flex.sdk.version}</version>
          <type>rb.swc</type>
          <scope>${flex.sdk.scope}</scope>        
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>flash-integration</artifactId>
          <version>${flex.sdk.version}</version>
          <type>rb.swc</type>
          <scope>${flex.sdk.scope}</scope>        
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>framework</artifactId>
          <version>${flex.sdk.version}</version>
          <type>rb.swc</type>
          <scope>${flex.sdk.scope}</scope>        
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>osmf</artifactId>
          <version>${flex.sdk.version}</version>
          <type>rb.swc</type>
          <scope>${flex.sdk.scope}</scope>                
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>rpc</artifactId>
          <version>${flex.sdk.version}</version>
          <type>rb.swc</type>
          <scope>${flex.sdk.scope}</scope>                
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>spark</artifactId>
          <version>${flex.sdk.version}</version>
          <type>rb.swc</type>
          <scope>${flex.sdk.scope}</scope>        
        </dependency>
        <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>textLayout</artifactId>
          <version>${flex.sdk.version}</version>
          <type>rb.swc</type>
          <scope>${flex.sdk.scope}</scope>        
        </dependency>
    </dependencies>