【发布时间】:2014-06-01 11:08:17
【问题描述】:
我有以下结构的maven项目:
/parent
|- module1
| |- submoduleA
| |- submoduleB
|- module2
|- testng.xml
在父模块、每个模块和每个子模块中,当然有 pom.xml。我希望parent/testng.xml 在父模块、每个模块和子模块中使用,在surefire 插件配置中。
所以我在父 pom.xml 中配置了surefire:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>${basedir}/testng.xml</suiteXmlFiles>
</configuration>
...
</plugin>
这样的配置不起作用,因为${basedir} 始终是当前模块或子模块的目录。所以对于 module1,它会寻找 parent/module1/testng.xml,对于 submoduleA,它会寻找 parent/module1/submoduleA/testng.xml 等等。
我想为每个模块和子模块使用parent/testng.xml。我应该如何配置surefire来做到这一点?
【问题讨论】:
-
maven-remote-resources-plugin 可能是解决您问题的更好方法,或者想一想为什么您有一个 testng.xml 套件文件?
-
我需要 testng.xml 来解决这个问题:stackoverflow.com/questions/23959039/…
标签: maven