Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run test cases of particular module in multi module project using maven

Tags:

java

junit

maven

  1. A multi module maven project.

    Project ABC -- Module A -- Module B -- Module C

  2. Module B has Module A dependency.

  3. Want to run test cases of only Module B. But build all modules.

Note :I need a mvn command which builds dependent module A first(no test case of this module should run).. then run test case of module B only.. mvn command from parent..

Update ::

I tried this command

mvn test -am -DfailIfNoTests=false -pl B

Problem is its running module A test cases also. but i don't want to run module A test case. I want only module B test case to be running.

like image 533
Vinay S Jain Avatar asked May 03 '17 06:05

Vinay S Jain


1 Answers

Build and execute a specific test from a specific sub module:

mvn test -DfailIfNoTests=false -Dtest=test-class-name -pl submodule

As your submodule depends on other submodule you need -DfailIfNoTests=false

like image 155
Jay Smith Avatar answered Oct 29 '22 19:10

Jay Smith