【问题标题】:maven 3 surefire and maven gwt exclude / include problemsmaven 3 surefire 和 maven gwt 排除/包含问题
【发布时间】:2012-12-21 13:35:44
【问题描述】:

我有一个配置了 maven-surefire-plugin 的根 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>

与

<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 测试,并在本地包含它们。

但是,包含/排除部分会合并,因此两个不兼容的语法定义将无法一起工作。

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

【问题讨论】:

    标签: maven gwt maven-surefire-plugin


    【解决方案1】:

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

    【讨论】:

    • 我猜这仍然不能解释 maven 2 和 maven 3 之间的区别以及分层的东西。
    • 感谢您的建议,但我想在不改变我的项目特性的情况下解决问题,我只想升级到maven 3
    猜你喜欢
    • 2012-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-16
    • 1970-01-01
    • 2011-01-27
    • 2014-01-07
    • 1970-01-01
    相关资源
    最近更新 更多