1

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

Ravi
  • 35
  • 1
  • 8

2 Answers2

2

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
J_A_X
  • 12,857
  • 1
  • 25
  • 31
  • @ravi, could you post your new pom in your original question? – J_A_X Aug 02 '11 at 23:53
  • 3
    I also used the maven archetypes from the example and got dependency download problems. Not sure how to resolve. Looking at different flex mojos. – Peter Delaney Aug 28 '11 at 16:05
  • My situation is as Delaney. A clue for me currently is the message "Failure to find com.adobe.flex:compiler:pom:3.2.0.3958 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced". Now I've just got to find the maven runes to force it perhaps... – Danny Staple May 04 '12 at 18:50
  • Ok - http://stackoverflow.com/questions/4701532/force-maven-update - suggests how to force this. However, bad news - both mvn clean, and "mvn clean install -U" still result in the same error. – Danny Staple May 04 '12 at 18:52
  • Trying this: "rm -rf ~/.m2/repository/org/sonatype/flexmojos ~/.m2/repository/com/adobe", followed by "mvn clean". Then try the mvn install. – Danny Staple May 04 '12 at 18:54
  • Danny, this is an old version of FlexMojos, it has gone through a fairly major rebuild since then. Try this instead: `mvn archetype:generate -DarchetypeGroupId=net.flexmojos.oss -DarchetypeArtifactId=flexmojos-archetypes-application -DarchetypeVersion=5.0-beta` I tried it myself, it created the structure but wouldn't compile because there variables didn't get replaced in the pom file with the ones I wanted. You only need to go in and fix those vars and then change the flex sdk number to `4.6.b.23201`. That should do it. – J_A_X May 04 '12 at 21:16
1

I think you should use net.flexmojos.oss which has superseeded the org.sonatype.flexmojos with new versions up to 6.0.0 Most dependencies (except from adobe) can be found in central. You should mavenize FDK as explained in https://flexmojos.atlassian.net/wiki/display/FLEXMOJOS/Flexmojos+6.x

lrkwz
  • 6,105
  • 3
  • 36
  • 59