Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven - Run JUnit Testsuite in module

I have 3 Projects:

  • ParentProj (parent of A+B)
  • ProjA (is a module of ParentProj, contains sources)
  • ProjB (is a module of ParentProj, contains sources and tests)

Build order is: 1. ParentProj, 2. ProjA, 3. ProjB (could not be changed!)

I want to tell maven to execute a TestSuite that is located in ProjB. If I run the build with this command: mvn clean -e test -Dtest=AllServiceTests, the build will fail because maven could not find the "AllServiceTests"-class in ProjA, which is build before ProjB.

Is there any solution for this problem? (Changing the build order is no solution)

like image 544
L.Butz Avatar asked Dec 16 '22 15:12

L.Butz


1 Answers

I just found the solution:

clean install test -Dtest=myTestSuite -DfailIfNoTests=false 

-DfailIfNoTests=false will force maven to continue with the build if ProjA contains no Test classes.

That finally fixed my problem.

like image 103
L.Butz Avatar answered Dec 28 '22 07:12

L.Butz