I have an application which use the Eclipse RCP. I have severals plugins, they each have a pom.xml file, and all the project has a super pom.xml.
The structure is :
plugin.a ( pom.xml inside )
plugin.b ( pom.xml inside )
plugin.c ( pom.xml inside )
plugin.test ( with a pom.xml too, contains all JUnit tests classes )
pom.xml
My problem is, when i launch the command : mvn integration-test
Maven tries to execute all *Test.java, but if it doesn't find it crashes ( for example in plugin a / b / c ).
How exclude specifics plugins to avoid this compilation error ?
Thank you in advance.
Edit : I found. In Each pom.xml, i was in <packaging>eclipse-test-plugin</packaging>
and no in <packaging>eclipse-plugin</packaging>
if i want to avoid compilation error in non tests plugins.
But thank you for help guys. <3
You can distinguish which tests run in which phase using both the surefire plugin (Unit Testing) and the failsafe plugin (Integration Testing)
As an example: (in parent pom.xml)
In your case I would think you need a similar configuration in every plugin module if there is no common pattern across the modules. So you can disable the execution per plugin.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<forkMode>once</forkMode>
<includes>
<include>**/Test*.java</include>
</includes>
<excludes>
<exclude>**/*</exclude>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>failsafe-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
</plugin>
If there is a common pattern but you want to just disable the execution you can add an execution to the plugin, giving it an id. A child pom can then re-configure that execution if it uses the same id
<plugin>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<configuration>
</configuration>
<executions>
<execution>
<id>test-run-thing-id</id>
<phase>install</phase>
<goals>
<goal>plugin-goal</goal>
</goals>
</execution>
</executions>
</plugin>