I have a scenario where i need to exclude certain tests in a module from running during the compilation. For that, i have a created a profile in that module's pom.xml as shown below,
<profiles>
<profile>
<id>excludeTests</id>
<activation>
<property>
<name>excludeTests</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<excludes>
<exclude>com/abc/def/MyPackage</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
In the command line, I am running the below command,
mvn clean test -DexcludeTests=true
The junit classes present under 'MyPackage' is still getting executed. Is my profile really getting picked. Please help me here to exclude the junits from this package while building.