apache-flexmavenbuildflexmojos

Maven, Flex build issue


I am new to Maven. I am trying to compile Flex using maven plug-in flexmojos. I am having hard time to get maven download files from public repository. Currently we do not have any company intranet repository. Maven always fails to download required files (eg: flex-framework) from repository. Initially I did not configure the proxy, but now I did. After that maven was able to communicate to the repositories but unable to download all the files. I did try deleting the 'repository' directory couple of times, and also tried re-installing maven software.

Because, it could not download the files I thought may be I should try copying the files manually into the default repository location (/.m2/repository) and did that. But still I get an error as below.

[ERROR] Failed to execute goal on project nuxi-nms-flex-stats: Could not resolve
dependencies for project nuxi:nuxi-nms-flex-stats :swf:1.0.0: The following artifacts 
could not be resolved: com.adobe.flex.framework:flex-framework:pom:4.1.0.16248,
com.adobe.flex .framework:playerglobal:0.swc:2:4.1.0.16248: Could not find artifact
com.adobe.flex.framework:flex-framework:pom:4.1.0.16248 in central 
http://search.maven.org/) -> [Help 1]

This error message is really frustrating me. I have also tried building a sample app from sonatype examples on how to build a Flex app. Even that fails with a similar message (this time it complained unable to download flex compiler)

<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>nuxi</groupId>
    <artifactId>nuxi-nms-flex</artifactId>
    <version>1.0.0</version>
</parent>
<groupId>nuxi</groupId>
<artifactId>nuxi-nms-flex-stats</artifactId>
<version>1.0.0</version>
<packaging>swf</packaging>
<name>nuxi nms flex stats</name>


<repositories>
    <repository>
        <id>central</id>
        <name>Central Maven Repository</name>
        <url>http://search.maven.org/</url>
        <layout>default</layout>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>org.sonatype.flexmojos</id>
        <name>Flex mojos plugin for maven</name>
        <url>https://repository.sonatype.org/content/groups/flexgroup</url>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
        </snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>com.adobe.flex</id>
        <name>Flex compiler</name>
        <url>https://repository.sonatype.org/content/groups/flexgroup</url>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
        </releases>
        <snapshots>
            <enabled>false</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
        </snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>com.adobe.flex.framework</id>
        <name>Flex Framework</name>
        <url>https://repository.sonatype.org/content/groups/flexgroup</url>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
        </releases>
        <snapshots>
            <enabled>false</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

<build>
    <sourceDirectory>src/main/flex</sourceDirectory>
    <testSourceDirectory>src/test/flex</testSourceDirectory>
    <plugins>
        <plugin>
            <groupId>org.sonatype.flexmojos</groupId>
            <artifactId>flexmojos-maven-plugin</artifactId>
            <version>4.0-SNAPSHOT</version>
            <extensions>true</extensions>
            <configuration>
                <sourceFile>statsapp.mxml</sourceFile>
                <htmlName>SampleSWF</htmlName>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>com.adobe.flex</groupId>
                    <artifactId>compiler</artifactId>
                    <!--
                    <version>4.0.0.10485</version>
                    -->
                    <version>4.1.0.16248</version>
                    <type>pom</type>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
    <finalName>statsapp</finalName>
</build>
<dependencies>
    <dependency>
        <groupId>com.adobe.flex.framework</groupId>
        <artifactId>flex-framework</artifactId>
        <!--
        <version>4.0.0.10485</version>
        -->
        <version>4.1.0.16248</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>4.1.0.16248</version>
       <classifier>2</classifier>
       <type>0.swc</type>
   </dependency>
</dependencies>

My question is, am I doing anything wrong? What could be the issue here? Any help in this regard is appreciated.... Thanks...

Sorry for such a lengthy explanation...


Solution

  • This could be easily fixed by using maven archetypes instead of building it manually. As a good starting point, do this in the command line to create you folder structure & initial pom:

    mvn archetype:generate -DarchetypeRepository=http://repository.sonatype.org/content/groups/public -DarchetypeGroupId=org.sonatype.flexmojos -DarchetypeArtifactId=flexmojos-archetypes-application -DarchetypeVersion=3.5.0