我如何获得的FlexUnit,和的Flexmojos缀有蘑古力一起工作?(How do I get

2019-10-29 19:54发布

在过去的两年里,我一直在试图让得到的FlexUnit,的Flexmojos,并缀有蘑古力一起工作,这样我可以在TeamCity的运行测试,但我没有任何运气。

我有一个TeamCity的项目目前使用的Flexmojos和的Flexmojos-的FlexUnit这样的作品,但该项目未使用缀有蘑古力。

该项目的POM看起来是这样的:

<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>CENSOREDt</groupId>
<artifactId>CENSORED</artifactId>
<version>CENSORED</version>
<name>CENSORED</name>

<packaging>swc</packaging>

<properties>
    <flex.version>4.1.0.16248</flex.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <sonar.language>flex</sonar.language>
    <sonar.dynamicanalysis>false</sonar.dynamicanalysis>
</properties>

<dependencies>
    <dependency>
    CENSORED
    <dependency>
        <groupId>org.puremvc.as3</groupId>
        <artifactId>PureMVC_AS3</artifactId>
        <version>2.0.4</version>
        <type>swc</type>
    </dependency>
    <dependency>
        <groupId>com.adobe</groupId>
        <artifactId>componentsFlashIDE</artifactId>
        <type>swc</type>
        <version>0.0.1</version>
    </dependency>
    <dependency>
        <groupId>fl</groupId>
        <artifactId>components</artifactId>
        <version>1.0</version>
        <type>swc</type>
    </dependency>
    <dependency>
        <groupId>com.greensock</groupId>
        <artifactId>greensock</artifactId>
        <version>v11</version>
        <type>swc</type>
    </dependency>
    <dependency>
        <groupId>caurina.transitions</groupId>
        <artifactId>Tweener</artifactId>
        <version>1.2</version>
        <type>swc</type>
    </dependency>
    <!-- test-scope dependencies: -->
    <dependency>
        <groupId>org.sonatype.flexmojos</groupId>
        <artifactId>flexmojos-unittest-flexunit4</artifactId>
        <version>4.1-beta</version>
        <type>swc</type>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>com.adobe.flex.framework</groupId>
                <artifactId>playerglobal</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.adobe.flex.framework</groupId>
                <artifactId>airframework</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-as3</artifactId>
        <version>1.1</version>
        <type>swc</type>
        <scope>test</scope>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>artifactory-libs</id>
        <name>artifactory-libs-release</name>
        <url>http://artifactory/artifactory/libs-release-local</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>artifactory-snapshots</id>
        <name>artifactory-libs-snapshots</name>
        <url>http://artifactory/artifactory/libs-snapshot-local</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
    <repository>
        <id>artifactory-ext</id>
        <name>artifactory-ext-release</name>
        <url>http://artifactory/artifactory/ext-release-local</url>
    </repository>
    <repository>
        <id>flex-mojos-repository</id>
        <name>flex-mojos-repository</name>
        <url>http://repository.sonatype.org/content/groups/flexgroup</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>flex-mojos-plugin-repository</id>
        <url>http://repository.sonatype.org/content/groups/flexgroup</url>
    </pluginRepository>
    <pluginRepository>
        <id>flexpmd.opensource.adobe</id>
        <name>FlexPMD repository on opensource.adobe.com</name>
        <url>http://opensource.adobe.com/svn/opensource/flexpmd/maven-repository/release/</url>
    </pluginRepository>
</pluginRepositories>

<distributionManagement>
    <repository>
        <id>artifactory</id>
        <name>artifactory-releases</name>
        <url>http://artifactory/artifactory/libs-release-local</url>
    </repository>
    <snapshotRepository>
        <id>artifactory</id>
        <name>artifactory-snapshots</name>
        <url>http://artifactory/artifactory/libs-snapshot-local</url>
    </snapshotRepository>
</distributionManagement>

<build>
    <finalName>${project.artifactId}</finalName>
    <testSourceDirectory>test</testSourceDirectory>
    <sourceDirectory>src/</sourceDirectory>
    <plugins>
        <plugin>
            <groupId>org.sonatype.flexmojos</groupId>
            <artifactId>flexmojos-maven-plugin</artifactId>
            <version>4.0-RC2</version>
            <extensions>true</extensions>

            <dependencies>
                <dependency>
                    <groupId>com.adobe.flex</groupId>
                    <artifactId>compiler</artifactId>
                    <version>${flex.version}</version>
                    <type>pom</type>
                </dependency>
            </dependencies>
            <configuration>
                <storepass/>
                <targetPlayer>10.1</targetPlayer>
                <compilerWarnings>
                    <warn-no-constructor>false</warn-no-constructor>
                </compilerWarnings>
            </configuration>
        </plugin>
    </plugins>
</build>

<reporting>
</reporting>

它工作正常。 当我添加引用然而缀有蘑古力,构建失败,因为某种冲突的阶级的FlexUnit的。

我读这在此处链接 ,我需要删除提及的Flexmojos-的FlexUnit并给予在POM我自己参考FlexUnit4中。 我这样做。 但是现在,我得到一个错误阅读:

Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:4.0-RC2:test-compile (default-test-compile) on project slots_client_common: java.lang.reflect.InvocationTargetException: Not found any compatible unit test framework

我现在的POM这是不工作看起来像这样:

<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.CENSORED.client</groupId>

<artifactId>CENSORED</artifactId>
<version>CENSORED</version>
<name>CENSORED</name>

<packaging>swc</packaging>

<properties>
    <flex.version>4.1.0.16248</flex.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <sonar.language>flex</sonar.language>
    <sonar.dynamicanalysis>false</sonar.dynamicanalysis>
</properties>

<dependencies>
    <dependency>
    CENSORED
    </dependency>
    <dependency>
        CENSORED
    </dependency>
    <dependency>
        <groupId>org.puremvc.as3</groupId>
        <artifactId>PureMVC_AS3</artifactId>
        <version>2.0.4</version>
        <type>swc</type>
    </dependency>
    <!-- test-scope dependencies: -->

    <dependency>
        <groupId>com.adobe.felxunit</groupId>
        <artifactId>flexunit</artifactId>
        <version>4.1.0-8</version>
        <classifier>as3</classifier>
        <type>swc</type>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>com.adobe.flex.framework</groupId>
                <artifactId>playerglobal</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.adobe.flex.framework</groupId>
                <artifactId>airframework</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-as3</artifactId>
        <version>1.1</version>
        <type>swc</type>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockolate</groupId>
        <artifactId>mockolate</artifactId>
        <version>0.12.4</version>
        <classifier>as3</classifier>
        <type>swc</type>
        <scope>test</scope>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>artifactory-libs</id>
        <name>artifactory-libs-release</name>
        <url>http://artifactory/artifactory/libs-release-local</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>artifactory-snapshots</id>
        <name>artifactory-libs-snapshots</name>
        <url>http://artifactory/artifactory/libs-snapshot-local</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>artifactory-ext</id>
        <name>artifactory-ext-release</name>
        <url>http://artifactory/artifactory/ext-release-local</url>
    </repository>
    <repository>
        <id>flex-mojos-repository</id>
        <name>flex-mojos-repository</name>
        <url>http://repository.sonatype.org/content/groups/flexgroup</url>
    </repository>

</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>flex-mojos-plugin-repository</id>
        <url>http://repository.sonatype.org/content/groups/flexgroup</url>
    </pluginRepository>
    <pluginRepository>
        <id>flexpmd.opensource.adobe</id>
        <name>FlexPMD repository on opensource.adobe.com</name>
        <url>http://opensource.adobe.com/svn/opensource/flexpmd/maven-repository/release/</url>
    </pluginRepository>
</pluginRepositories>


<distributionManagement>
    <repository>
        <id>artifactory</id>
        <name>artifactory-releases</name>
        <url>http://artifactory/artifactory/libs-release-local</url>
    </repository>
    <snapshotRepository>
        <id>artifactory</id>
        <name>artifactory-snapshots</name>
        <url>http://artifactory/artifactory/libs-snapshot-local</url>
    </snapshotRepository>
</distributionManagement>


<build>
    <finalName>${project.artifactId}</finalName>
    <testSourceDirectory>tests</testSourceDirectory>
    <sourceDirectory>src/</sourceDirectory>
    <plugins>
        <plugin>
            <groupId>org.sonatype.flexmojos</groupId>
            <artifactId>flexmojos-maven-plugin</artifactId>
            <version>4.0-RC2</version>
            <extensions>true</extensions>

            <dependencies>
                <dependency>
                    <groupId>com.adobe.flex</groupId>
                    <artifactId>compiler</artifactId>
                    <version>${flex.version}</version>
                    <type>pom</type>
                </dependency>
            </dependencies>
            <configuration>
                <targetPlayer>10.1</targetPlayer>
                <compilerWarnings>
                    <warn-no-constructor>false</warn-no-constructor>
                </compilerWarnings>
                <storepass/>
            </configuration>
        </plugin>
    </plugins>
</build>

该FlexUnit4中SWC存在于我的artifactory的,和IntelliJ让我在Maven没有警告或错误试图建立之前。

谢谢你的帮助。

Answer 1:

由于在Apache一些伟大的乡亲的Flex开发论坛 (弗雷德里克·托马斯和@chrisdutz)我能得到的回答我的问题:

首先,你需要mavenize的SDK要使用,于我而言,这是的Flex SDK 4.1A

然后,你可以设置你的POM这样的:

<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>testMaven</groupId>
<artifactId>testMaven</artifactId>
<version>1.0-SNAPSHOT</version>

<packaging>swf</packaging>

<properties>
    <flexmojos.version>6.0.1</flexmojos.version>
    <flex.version>4.1.0.16076A</flex.version>
    <playerglobal.version>10.1</playerglobal.version>
    <flashplayer.version>10.1</flashplayer.version>
    <flex.debug>true</flex.debug>
</properties>

<build>
    <sourceDirectory>src</sourceDirectory>
    <testSourceDirectory>tests</testSourceDirectory>
    <plugins>
        <plugin>
            <groupId>net.flexmojos.oss</groupId>
            <artifactId>flexmojos-maven-plugin</artifactId>
            <version>${flexmojos.version}</version>
            <extensions>true</extensions>
            <configuration>
                <storepass/>
                <targetPlayer>10.1</targetPlayer>
                <debug>${flex.debug}</debug>
                <defines>
                    <property>
                        <name>CONFIG::debugging</name>
                        <value>${flex.debug}</value>
                    </property>
                   <property>
                        <name>CONFIG::versionNumber</name>
                        <value>'${project.version}'</value>
                    </property>
                </defines>
                <sourceFile>com/myCompany/main/HelloWorld.as</sourceFile>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>com.adobe.flex</groupId>
                    <artifactId>compiler</artifactId>
                    <version>${flex.version}</version>
                    <type>pom</type>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>com.adobe.flex.framework.themes</groupId>
        <artifactId>halo</artifactId>
        <version>${flex.version}</version>
        <scope>theme</scope>
        <type>swc</type>
    </dependency>

    <dependency>
        <groupId>com.adobe.flash.framework</groupId>
        <artifactId>playerglobal</artifactId>
        <version>${playerglobal.version}</version>
        <type>swc</type>
    </dependency>
    <dependency>
        <groupId>com.adobe.flash.framework</groupId>
        <artifactId>playerglobal</artifactId>
        <version>${playerglobal.version}</version>
        <type>rb.swc</type>
    </dependency>
    <dependency>
        <groupId>com.adobe.flex.framework</groupId>
        <artifactId>flash-integration</artifactId>
        <version>${flex.version}</version>
        <type>swc</type>
    </dependency>
    <dependency>
        <groupId>com.adobe.flex.framework</groupId>
        <artifactId>flex-framework</artifactId>
        <version>${flex.version}</version>
        <type>pom</type>
    </dependency>
   <dependency>
        <groupId>com.adobe.flex.framework</groupId>
        <artifactId>flash-integration</artifactId>
        <version>${flex.version}</version>
        <type>rb.swc</type>
    </dependency>
    <dependency>
        <groupId>org.flexunit</groupId>
        <artifactId>flexunit</artifactId>
        <version>4.1.0</version>
        <classifier>as3</classifier>
        <type>swc</type>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-as3</artifactId>
        <version>1.1</version>
        <type>swc</type>
    </dependency>
    <dependency>
        <groupId>org.mockolate</groupId>
        <artifactId>mockolate</artifactId>
        <version>0.12.4</version>
        <classifier>as3</classifier>
        <type>swc</type>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>artifactory-libs</id>
        <name>artifactory-libs-release</name>
        <url>http://artifactory/artifactory/libs-release-local</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>artifactory-snapshots</id>
        <name>artifactory-libs-snapshots</name>
        <url>http://artifactory/artifactory/libs-snapshot-local</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>artifactory-ext</id>
        <name>artifactory-ext-release</name>
        <url>http://artifactory/artifactory/ext-release-local</url>
    </repository>
    <repository>
        <id>flex-mojos-repository</id>
        <name>flex-mojos-repository</name>
        <url>http://repository.sonatype.org/content/groups/flexgroup</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>flex-mojos-plugin-repository</id>
        <url>http://repository.sonatype.org/content/groups/flexgroup</url>
    </pluginRepository>
    <pluginRepository>
        <id>flexpmd.opensource.adobe</id>
        <name>FlexPMD repository on opensource.adobe.com</name>
        <url>http://opensource.adobe.com/svn/opensource/flexpmd/maven-repository/release/</url>
    </pluginRepository>
</pluginRepositories>



文章来源: How do I get Flexunit, FlexMojos and Mockolate to work together?