6
  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.

Vinay S Jain
  • 111
  • 1
  • 11

1 Answers1

3

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

Jay Smith
  • 2,331
  • 3
  • 16
  • 27
  • And `-am` to get Module A built. – Stanislav Bashkyrtsev May 03 '17 at 06:55
  • Thanks for reply... But 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. – Vinay S Jain May 03 '17 at 07:12
  • 3
    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. – Vinay S Jain May 03 '17 at 07:28
  • hello @VinaySJain, have you found a solution for your task? as i am having same problem now.. – Ann May 11 '20 at 09:32