com.atlassian.maven.plugin.clover.CloverIntegrationOptimizerMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-clover2-plugin Show documentation
Show all versions of maven-clover2-plugin Show documentation
Maven plugin for Clover.
MIGRATION NOTICE: Since next major Clover release this plugin will be renamed to
com.atlassian.maven.plugins:clover-maven-plugin. Thus, goals will also be renamed, e.g.
'clover2:setup' will become 'clover:setup'.
The newest version!
package com.atlassian.maven.plugin.clover;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.util.List;
/**
* Sets the 'test' property on the project which is used by the maven-surefire-plugin to determine which tests are run.
* If a snapshot file from a previous build, is found, that will be used to determine what tests should be run.
*
* @goal optimizeIntegration
* @phase pre-integration-test
*/
public class CloverIntegrationOptimizerMojo extends CloverOptimizerMojo {
protected List extractNestedStrings(final String elementName, final Plugin surefirePlugin) {
List value = null;
//Try to get the value for the Surefire config for the "integration-test", if there is one
//but default to the global config otherwise
final List executions = surefirePlugin.getExecutions();
for (PluginExecution execution : executions) {
if ("integration-test".equals(execution.getPhase())) {
Xpp3Dom config = (Xpp3Dom) execution.getConfiguration();
value = config == null ? null : extractNestedStrings(elementName, config);
break;
}
}
return value == null ? super.extractNestedStrings(elementName, surefirePlugin) : value;
}
}