Reputation:
I wonder why it is not working corecttly. I want to have itTest profle which will start integration(failsafe plugin) and unit(surefire plugin) via Maven. My configuration:
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>${unit-tests.skip}</skip>
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<skip>${integration-tests.skip}</skip>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
profile
<profile>
<id>itTest</id>
<properties>
<propFile>profiles/itTest.properties</propFile>
<spring.profile>itTest</spring.profile>
<integration-tests.skip>false</integration-tests.skip>
<unit-tests.skip>false</unit-tests.skip>
</properties>
</profile>
Result: both tests are skipped... even i change profile or hardcoded skip to false it still doesnt work.
Upvotes: 2
Views: 4896
Reputation: 5652
Rather than putting both plugins in as default and trying to skip them I think you can simply declare the plugins within the profiles themselves. I.e.
<profile>
<id>itTest</id>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugins>
Upvotes: 1
Reputation: 35805
I don't know why exactly your configuration does not do what you want it to do (probably something about the order in which properties are evaluated, so the property is already evaluated when you reset it), but the usual way to handle this is to put the whole plugin configuration into the profile.
Upvotes: 0