I currently work in big project built by Maven which has many integration tests modules which are marked as main (not testing) sources. I am trying to create a profile which would skip compilation of these modules. I expected gmaven plugin to allow "skip" configuration parameter but this is not the case. Is there any way to skip module processing without pointing gmaven plugin to non-existent directory and without copy-paste of all modules except integration tests to a separate profile?
Asked
Active
Viewed 818 times
1
-
dont understand your question ! you use org.codehaus.gmaven:groovy-maven-plugin? – question_maven_com Nov 06 '15 at 09:18
1 Answers
1
You can put the integration test modules in a separate profile of the parent pom where you list the modules. The profile should be active unless you disable it by setting a property when running the Maven build (-DskipIntegrationTestModules
). (Don't use activeByDefault.)
<modules>
<module>my-project</module>
</modules>
<profiles>
<profile>
<id>build-integration-tests</id>
<activation>
<property>
<name>!skipIntegrationTestModules</name>
</property>
</activation>
<modules>
<module>my-project-integration-test</module>
</modules>
</profile>
</profiles>
You can find more details in the Maven Introduction to Build Profiles.
You should also know that it can be dangerous to have modules in build profiles because they could be accidentally left out when doing release builds. I think it should be OK in this case because the profile has to be deactivated explicitly.

Community
- 1
- 1

Michael Koch
- 1,152
- 11
- 17