maven 3 surefire和maven gwt排除/包含问题

时间:2013-01-07 19:11:00

标签: gwt maven surefire

我有一个配置了maven-surefire-plugin的root pom和一个配置了gwt-maven-plugin的gwt模块pom。 升级到Maven 3后,我发现了一些奇怪的错误。

该项目的配置类似于此处所述:Separate GwtTest tests from standard unit tests

 <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <useSystemClassLoader>true</useSystemClassLoader>
                    <useManifestOnlyJar>false</useManifestOnlyJar>
                    <forkMode>always</forkMode>
                    <properties>
                        <property>
                            <name>usedefaultlisteners</name>
                            <value>false</value>
                        </property>
                        <property>
                            <name>listener</name><value>org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter</value>
                        </property>
                    </properties>
                    <argLine>-server -Xmx8192m -XX:MaxPermSize=1024M -XX:+CMSClassUnloadingEnabled</argLine>
                    <excludes><exclude>**/*GwtTest*.java</exclude></excludes>
                </configuration>
            </plugin>

AND

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.5.0</version>
                <dependencies>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-user</artifactId>
                        <version>${gwt.version}</version>                       
                    </dependency>
                </dependencies>
                <configuration>
                    <modules>
                        <module>my.app.gwt</module>
                    </modules>
                    <runTarget>/</runTarget>

                    <extraJvmArgs>-Xss512m -Xmx2048m -XX:MaxPermSize=256M</extraJvmArgs>
                    <hostedWebapp>
                        ${project.build.directory}/${project.build.finalName}
                    </hostedWebapp>
                    <includes>**/*GwtTestSuite.java</includes>
                    <copyWebapp>true</copyWebapp>
                    <logLevel>INFO</logLevel>
<persistentunitcache>false</persistentunitcache>

                    <draftCompile>${gwt.draftCompile}</draftCompile>
                    <deploy>${project.build.directory}/${project.build.finalName}/WEB-INF/deploy</deploy>
<disableCastChecking>true</disableCastChecking> -->

                    <mode>htmlunit</mode>

                    <skipTests>${skipGwtTests}</skipTests>

                    </configuration>
                <executions>
                    <execution>
                        <id>gwt-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                    <execution>
                        <id>gwt-test</id>
                        <goals>
                            <goal>compile</goal>
                            <goal>test</goal>
                        </goals>
                        <phase>test</phase>
                    </execution>
                </executions>
            </plugin>

它适用于maven 2但是我使用了maven 3:

[ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.5.0:test (gwt-test) on project my-webapp: Unable to parse configuration of mojo org.codehaus.mojo:gwt-maven-plugin:2.5.0:test: When configuring a basic element the configuration cannot contain any child elements. Configuration element 'excludes'. -> [Help 1]

似乎gwt插件无法解析surefire插件的层次结构样式。

如果我将gwt插件中的所有排除/包含设置为一个逗号分隔的字符串行,它只会编译,但这对我不起作用,因为我需要全局排除gwt测试,并将它们包含在本地。

但是,include / exclude部分已合并,因此两个不兼容的语法定义将无法一起使用。

我希望有人能给我一个提示。

1 个答案:

答案 0 :(得分:0)

您可以使用直接Maven Surefire运行GWTTestCases,请参阅this link