mavenintellij-ideaapache-flexflexmojosflex-mojos

Flex Maven project compilation error: Global artifact is not available. Make sure to add 'playerglobal' or 'airglobal' to this project


I am converting an existing flex project to a maven project using the IntelliJ IDEA. As per the R&D on google, I have added the pom.xml file and I have resolved multiple issues by adding the required dependencies. However, I am stuck at one point now where despite adding the required dependency in pom file, the 'compile' goal keeps throwing error.

Error:

Failed to execute goal net.flexmojos.oss:flexmojos-maven-plugin:7.1.0:compile-swf (default-compile-swf) on project TA_UI_Test1: java.lang.reflect.InvocationTargetException: Global artifact is not available. Make sure to add 'playerglobal' or 'airglobal' to this project. -> [Help 1]

pom.xml file:

<?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.test</groupId>
  <artifactId>TA_UI_Test1</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>swf</packaging>

  <name>TA_UI_Test1 Flex</name>

  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <groupId>net.flexmojos.oss</groupId>
        <artifactId>flexmojos-maven-plugin</artifactId>
        <version>7.1.0</version>
        <extensions>true</extensions>
          <configuration>
              <sourceFile>Main.mxml</sourceFile>
              <debug>true</debug>
              <!--<swfVersion>11</swfVersion>-->
              <!--<targetPlayer>10.2</targetPlayer>-->
          </configuration>
          <dependencies>
              <dependency>
                  <groupId>com.adobe.flex</groupId>
                  <artifactId>compiler</artifactId>
                  <version>4.6.b.23201</version>
                  <type>pom</type>
              </dependency>
          <dependency>
            <groupId>com.adobe.flex.compiler</groupId>
            <artifactId>flex-compiler-oem</artifactId>
            <version>4.1.0.16076</version>
          </dependency>
          <dependency>
            <groupId>com.adobe.flex.compiler</groupId>
            <artifactId>mxmlc</artifactId>
            <version>4.1.0.16076</version>
          </dependency>
          <!--<dependency>-->
            <!--<groupId>com.adobe.flex.framework</groupId>-->
            <!--<artifactId>playerglobal</artifactId>-->
            <!--<version>10-3.3.0.4852</version>-->
            <!--<type>swc</type>-->
          <!--</dependency>-->
            <!--<dependency>-->
                <!--<groupId>com.adobe.flex.framework</groupId>-->
                <!--<artifactId>playerglobal</artifactId>-->
                <!--<version>4.5.1.21328</version>-->
                <!--<classifier>10</classifier>-->
                <!--<type>2.swc</type>-->
            <!--</dependency>-->
              <dependency>
                  <groupId>com.adobe.flex.framework</groupId>
                  <artifactId>playerglobal</artifactId>
                  <version>3.2.0.3958</version>
                  <classifier>9</classifier>
                  <type>swc</type>
              </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

  <dependencies>        
    <dependency>
      <groupId>com.adobe.flex.framework</groupId>
      <artifactId>flex-framework</artifactId>
      <version>4.6.b.23201</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.adobe.flex.compiler</groupId>
      <artifactId>asdoc</artifactId>
      <version>4.6.b.23201</version>
    </dependency>
    <dependency>
      <groupId>com.adobe.flex</groupId>
      <artifactId>compiler</artifactId>
      <version>4.6.b.23201</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.adobe.flex.compiler</groupId>
      <artifactId>flex-compiler-oem</artifactId>
      <version>3.6.0.16995</version>
    </dependency>
    <dependency>
      <groupId>com.adobe.flexunit</groupId>
      <artifactId>flexunit</artifactId>
      <version>0.85</version>
      <type>swc</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.adobe.flex.compiler</groupId>
      <artifactId>mxmlc</artifactId>
      <version>4.1.0.16076</version>
    </dependency>
      <!--<dependency>-->
          <!--<groupId>com.adobe.flex.framework</groupId>-->
          <!--<artifactId>playerglobal</artifactId>-->
          <!--<version>10-3.3.0.4852</version>-->
          <!--<classifier>10.2</classifier>-->
          <!--<type>swc</type>-->
      <!--</dependency>-->
      <!--<dependency>-->
          <!--<groupId>com.adobe.flex.framework</groupId>-->
          <!--<artifactId>playerglobal</artifactId>-->
          <!--<version>4.5.1.21328</version>-->
          <!--<classifier>10</classifier>-->
          <!--<type>2.swc</type>-->
      <!--</dependency>-->
      <dependency>
          <groupId>com.adobe.flex.framework</groupId>
          <artifactId>playerglobal</artifactId>
          <version>3.2.0.3958</version>
          <classifier>9</classifier>
          <type>swc</type>
      </dependency>
  </dependencies>
</project>

Things I have tried:
1. I have added the required dependency of artifact playerglobal as seen in above pom.xml file, and I have tried with 3 different versions of it (seen above in pom). However, none of them helps.
2. I have tried adding playerglobal dependency inside the 'plugin' node, and also inside the common 'dependencies' node separately in pom. However, any of them are not helping. [Reason to try both these things is that for other couple of dependencies of flex-compiler-oem and mxmlc, it was not recognizing required classes when the dependencies were added just in the common 'dependencies' node. When I added them inside the 'plugin dependencies', then it moved on from those errors.]
3. As per this article, I have also tried keeping the 'com.adobe.flex > compiler' right after 'configuration' node. However, that also doesn't help.
4. I am using Maven 3.2.5 right now, but I have tried with various other maven versions like 3.3.9, 3.0.5, 3.1.1 too. They are also not helping. (3.3.9 is not supported for flexmojos-maven-plugin 7.1.0 as per this article. It also says that maven 3.2.5 is working fine though. Using maven 3.0.5 says that minimum required maven version is 3.1.1. And using maven 3.1.1 gives same error as I am getting right now with maven 3.2.5.)

My SDK/IDE versions:
Maven: 3.2.5
Flex: 3.2.0
JDK: 1.8
IntelliJ IDEA: Ultimate 2017.1

Any help would be greatly appreciated. Thanks in advance.


Solution

  • I have addressed above issue now. I came across some links which talked about mavenizing the Flex SDK, such as this and this. The second link is the one suggested by carlspring in his above answer; however, I could not follow its steps fully since the git URL mentioned in it is blocked in my company network. So I downloaded the code from the former link and created the mavenizer, and executed it as per the steps given in the link to generate the mavenized SDK. (I faced an issue in the mavenizer where the connection to external maven repository is done to check for updates, so I commented that code and created mavenized SDK successfully after that.)

    After generating the Mavenized SDK, you just have to copy it in your local maven repository, and then the playerglobal/airglobal dependencies will successfully get resolved.

    Note: In addition to the first link mentioned above, refer to this link as well, which has more detailed steps of mavenizing the Flex SDK. It helped me a lot in creating the folder structure properly.