I suggested that you try the test option (lowercase) of the Maven Surefire plugin to call a specific test that Surefire couldnโt find in the first reactor build module and therefore fails.
I also assume that integration tests are performed by the Maven Failsafe Plugin . If not, they should, as indicated in the official documentation:
The Failsafe plugin is designed to run integration tests, and the Surefire plugin is designed to run unit tests .... If you use the Surefire plugin to run tests, then when you have a test failure, the assembly will stop at the integration-test phase and your test environment the integration will not be properly erased ... The Failsafe plugin will not complete the build during the integration-test phase, thereby to complete the post-integration-test phase.
To make it shorter: it is safer and much more reliable.
Although the plugin configuration entry for the Maven Failsafe Plugin is also test , its corresponding command line option is it.test , so you should run instead:
mvn clean install -Dit.test=SampleIT
Where SampleIT is an integration test (pay attention to the standard IT suffix recognized by default from Failsafe.
The official documentation, โLaunching a Single Test,โ also contains additional information about running single integration tests.
Also note: the above call will work if you do not have other integration tests in other build modules, otherwise it will not be able to find it earlier (before removing the corresponding module).
If you use Surefire to run the appropriate integration test (again, it shouldn't) or you have several modules that run integration tests, you should configure a profile in the appropriate module that will take care of this particular call, something like the following:
<profiles> <profile> <id>run-single-it-test</id> <activation> <property> <name>single.it.test</name> </property> </activation> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.19.1</version> <configuration> <test>${single.it.test}</test> </configuration> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles>
And then call the assembly as follows:
mvn clean install -Dsingle.it.test=SampleIT
Thus, Maven will activate the profile depending on the existence of a value for the single.it.test property and pass it to the test Failsafe Plugin property (or Surefire, if that was the case), Failsafe will ignore any other integration test for this execution, and other modules will not suffer (ignoring this property).