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 clover-maven-plugin Show documentation
Show all versions of clover-maven-plugin Show documentation
Maven plugin for Clover.
MIGRATION NOTICE: Since Clover 4.1.0 this plugin is named com.atlassian.maven.plugins:clover-maven-plugin.
In previous versions it was named com.atlassian.maven.plugins:maven-clover2-plugin.
The newest version!
package com.atlassian.maven.plugin.clover;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
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.
*/
@Mojo(name = "optimizeIntegration", defaultPhase = LifecyclePhase.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;
}
}