问题描述
我有以下内容:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>javadoc-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
在包装或安装过程中可以正常工作的
Which works fine during packaging or installing:
mvn install或mvn软件包,但是,当我尝试指定要为测试运行的TestNG组时:
mvn install or mvn package, however, as soon as I try to specify a TestNG Group to run for the tests:
mvn install -Dgroups=somegroup
测试完成运行后失败,并显示以下错误:
it fails with the following error after tests finish running:
感谢您提供任何信息或指导.
Thanks for any info or guidance on this.
推荐答案
问题是surefire和javadoc插件都使用-Dgroups参数,在您的情况下,javadoc插件找不到"somegroup".
The problem is that both the surefire and javadoc plugins use the -Dgroups parameter, and in your case the javadoc plugin cannot find the "somegroup".
据我所知,目前尚无干净的解决方案,但是您可以通过在pom.xml中定义自定义属性来解决此问题:
As far as I know there is no clean solution for this, but you can do a workaround by defining a custom property in your pom.xml:
<properties>
<surefire.groups></surefire.groups>
</properties>
然后在surefire配置中使用该属性:
Then use the property in the surefire configuration:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
...
<configuration>
<groups>${surefire.groups}</groups>
</configuration>
</plugin>
现在,您可以使用surefire.groups属性从命令行运行测试:
Now you can run the tests from command line using the surefire.groups property:
mvn install -Dsurefire.groups=somegroup
这篇关于Maven 3 JavaDoc插件与TestNG组冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!