I have a maven profile defined like this:
<profile> <id>instrumentation</id> <activation> <activeByDefault>false</activeByDefault> <property> <name>instrumentation.enabled</name> <value>true</value> </property> </activation> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.5.1</version> <configuration> <formats> <format>xml</format> <format>html</format> </formats> <instrumentation> <ignores> </ignores> <excludes> <exclude>**/Test*.class</exclude> <exclude>**/Abstract*.java</exclude> <exclude>**/Log.class</exclude> <exclude>**/*Exception.class</exclude> </excludes> </instrumentation> </configuration> <executions> <execution> <phase>prepare-package</phase> <goals> <goal>cobertura</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>copy-resources</id> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <overwrite>true</overwrite> <outputDirectory>${env.DERBASE}/java/${project.artifactId}/target/classes</outputDirectory> <resources> <resource> <directory>${env.DERBASE}/java/${project.artifactId}/target/generated-classes/cobertura</directory> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles>
So what I would like to do is change this line;
<goal>cobertura</goal>
<goal>instrumentation</goal>
If an env variable is set, such as INSTRUMENTATION_EXCLUDE_TESTS.
I'm just wondering what is the best way to achieve this? (i.e. without copying and pasting a single line profile)
Thank you very much!
source share