I have a multi-module project:


  • Module A
  • Module B

Module B contains tests that depend on Module A running (ie. in an application server).

Right now, whenever I run mvn install Module A builds before Module B. There are two goals that execute during each build that start the module and then stop the module. The tests run in between these two goals; ie. start module > run tests > stop module

My problem right on is that Module A starts and stops before Module B runs its tests. Since the tests for Module B depend on Module A being started, they ultimately fail.

Is there any way to execute the start goals for both of these modules concurrently? ie. Module A starts > Module B starts > Module B runs its tests > Module A stops > Module B stops.

share|improve this question
  • It sounds (If I correctly understand) you have circular dependency in your tests...– khmarbaiseFeb 13 at 17:58
  • Not exactly, the tests depend on both modules running, but they execute as a part of one module. So, Module B depends on Module A but not the other way around. I guess what I need is a way to control the order of execution of the goals, such that I can execute the same goal for both modules strictly one after the other rather than waiting for the build to finish for one module first.– kubik42Feb 13 at 19:10
  • Can you please make an example project on github....– khmarbaiseFeb 14 at 7:37

I found a reasonable solution. What I ended up doing was define two profiles in Module B's pom, both of which use the exec-maven-plugin to execute the start/stop goals for Module A before (pre-integration-test) and after (post-integration-test) the tests in Module B.

share|improve this answer

    Your Answer


    By posting your answer, you agree to the privacy policy and terms of service.

    Not the answer you're looking for? Browse other questions tagged or ask your own question.