代码之家  ›  专栏  ›  技术社区  ›  Vaibhav Shah

Flex Maven项目编译错误:全局工件不可用。确保将“playerglobal”或“airglobal”添加到此项目

  •  1
  • Vaibhav Shah  · 技术社区  · 7 年前

    我正在使用IntelliJ思想将现有的flex项目转换为maven项目。根据R&在google上,我添加了pom。xml文件和我通过添加所需的依赖项解决了多个问题。然而,我现在陷入了一个困境,尽管在pom文件中添加了所需的依赖项,“编译”目标仍然会抛出错误。

    错误:

    无法执行目标 网flexmojos。oss:flexmojos maven插件:7.1.0:编译swf (默认编译swf)在项目TA\u UI\u Test1上: Java语言lang.reflect。InvocationTargetException:全局工件不是 可获得的确保在此添加“playerglobal”或“airglobal” 项目-&燃气轮机;[帮助1]

    pom。xml文件:

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

    我尝试过的事情:
    我已经添加了工件playerglobal所需的依赖项,如上面的pom所示。xml文件,我尝试了它的3个不同版本(见上面的pom)。然而,它们都没有帮助。
    2、我曾尝试在“plugin”节点中添加playerglobal依赖项,也尝试在pom中的公共“dependentials”节点中单独添加playerglobal依赖项。然而,他们中的任何一个都没有帮助。[尝试这两种方法的原因是,对于flex编译器oem和mxmlc的其他两个依赖项,当这些依赖项仅添加到公共“依赖项”节点时,它无法识别所需的类。当我将它们添加到“插件依赖项”中时,它就不再犯这些错误了。]
    3、根据 this 文章中,我也试着保留“com”。土砖灵活(>);“配置”节点后的“编译器”。然而,这也无济于事。
    我现在正在使用Maven 3.2.5,但我也尝试过其他各种Maven版本,如3.3.9、3.0.5、3.1.1。他们也没有帮助。(根据,flexmojos maven插件7.1.0不支持3.3.9 this 文章它还表示maven 3.2.5运行良好。使用maven 3.0.5表示所需的最低maven版本为3.1.1。使用maven 3.1.1会产生与我现在使用maven 3.2.5时相同的错误。)

    我的SDK/IDE版本:
    Maven:3.2.5
    弹性:3.2.0
    JDK:1.8
    IntelliJ IDEA:2017.1终极版

    任何帮助都将不胜感激。提前谢谢。

    2 回复  |  直到 7 年前
        1
  •  0
  •   carlspring    7 年前

    我不知道您对在Maven世界中使用Flex的熟悉程度有多深,但在Flash之后的世界中,关于如何使用Flex有很多讨论(我在大约5-6年的时间里都没有处理过建立和维护基于Flex Maven的项目)。基本上,Adobe不想将他们的工件发布到Maven Central,他们过去有自己的存储库。然后Adobe否认了他们的Flex项目,并将其贡献给Apache(如果我没记错的话,不是全部,而是大部分)。阿帕奇公司的员工在很大程度上进行了重新工作,现在是他们开发的。

    老实说,这些年来我一直没有关注Flex,因为我认为再也没有必要使用它了,就像HTML5一样,Flex似乎是一种过时的技术。世界不再使用Flash,这给每个人都带来了很多好处。然而,这只是我的观点,我不是UI专家。

    Apache的工作人员决定不重置版本,继续Adobe留下的只是工件坐标更改的地方。groupId-s现在是org。阿帕奇。flex*(您可以检查已发布的Apache flex依赖项 here ),而不是com。apache。*。这些工件现在可以通过Maven Central获得。您应该切换到更新版本的Maven,并至少使用3.3.9。

    有关项目历史的更多信息(这实际上非常重要,如果您想更好地了解依赖关系的混乱,以及现在什么是事实,什么不是事实,请检查 here here ). Flex文档现在位于Apache站点上。 This page 可能是我能找到的最新和最详细的,尽管我不能百分之百确定它是最新的。

    您必须进行进一步的阅读和调查,但根据上面的示例,您似乎正在使用非常非常旧的Flex库版本。我建议使用 Maven Central's search engine 并搜索 artifactId -并用最新的替换它们,看看情况如何。。。

    祝你好运!:)

        2
  •  0
  •   Vaibhav Shah    7 年前

    我现在已经解决了上述问题。我遇到了一些关于让Flex SDK专业化的链接,例如 this this . 第二个链接是卡尔斯普林在上述回答中提出的链接;然而,我无法完全遵循它的步骤,因为其中提到的git URL在我的公司网络中被阻止。因此,我从前面的链接下载了代码,创建了mavenizer,并按照链接中给出的步骤执行它,以生成mavenized SDK。(我在mavenizer中遇到了一个问题,连接到外部maven存储库是为了检查更新,所以我对代码进行了注释,并在之后成功创建了mavenized SDK。)

    生成Mavenized SDK后,只需将其复制到本地maven存储库中,playerglobal/airglobal依赖关系就会成功解决。

    注:除上述第一个链接外,请参阅 this 还有link,其中有更详细的Flex SDK专业化步骤。这对我正确创建文件夹结构有很大帮助。