I want to run unit test present in different modules of my maven project from a testng suite that contains specific test classes. One method that i have tried is to make another module and add dependencies of the different modules that i require test from as a test-jar but this method requires me to add all the dependencies that the modules i have added for test dependencies.
project is structure like
Project
|
|- Module A
|- src
|- suitefiles
|- pom.xml
|- Module B
|- src
|- suitefiles
|- pom.xml
|-pom.xml(Parent pom)
I have tried to add a third module like
Project
|
|- Module A
|- src
|- suitefiles
|- pom.xml
|- Module B
|- src
|- suitefiles
|- pom.xml
|- Module C
|- src
|- suitefiles
|- pom.xml <-(A and B as dependencies here)
|-pom.xml(Parent pom)
I want to omit making a separate module every time to run combine test from 2 modules. Is there a simpler way?
This should run tests for modules A and B both.
mvn test -pl A,B
References https://maven.apache.org/guides/mini/guide-multiple-modules-4.html https://blog.akquinet.de/2010/05/26/mastering-the-maven-command-line-reactor-options/ https://blog.sonatype.com/2009/10/maven-tips-and-tricks-advanced-reactor-options/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.