[英]Run a single java package on eclipse using maven
I have multiple java packages in my java project. 我的Java项目中有多个Java包。 Is it possible to run a single package on eclipse using maven.
是否有可能使用Maven在Eclipse上运行单个软件包。 I want to do it with the project level pom.
我想用项目级别的pom做到这一点。 I dont want to create POMs for every package.
我不想为每个程序包创建POM。
Based on your comment, not sure if this is what you are looking for but I use a configuration variable to run test cases for a particular package. 根据您的评论,不确定这是否是您要查找的内容,但是我使用配置变量来运行特定程序包的测试用例。 You have to add a plugin to the POM to achieve this.
您必须将插件添加到POM才能实现此目的。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<configuration>
<includes>
<include>**/${testGroup}/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
Now if you want to run the test cases for lets say package org/myPackage you would use a command like this. 现在,如果您要运行测试包org / myPackage的测试用例,则可以使用如下命令。
mvn test -DtestGroup=org/myPackage
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.