com.atlassian.maven.plugin.clover.CloverSetupMojo 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.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProject;
import org.apache.maven.plugin.MojoExecutionException;
import java.util.Date;
/**
* This mojo is to be used mainly for incremental instrumentation and compilation of Java source code.
*
* NB: This does not, nor should it, run in a forked lifecycle.
*
* This mojo should certainly *not* be called during a release build. This mojo instruments your source and test files
* to ${build.directory}/clover/src-instrumented and test-src-instrumented respectively. These directories are then set as the
* project's source and test source directories that subsequently get compiled by the compiler MOJO.
*/
@Mojo(name = "setup", defaultPhase = LifecyclePhase.PROCESS_SOURCES)
public class CloverSetupMojo extends CloverInstrumentInternalMojo {
static Date START_DATE;
@Override
public void execute() throws MojoExecutionException {
// store the start time of the build. ie - the very first compilation with clover.
final MavenProject firstProject = getReactorProjects().get(0);
if (firstProject == getProject()) {
START_DATE = new Date();
}
super.execute();
}
@Override
protected boolean shouldRedirectArtifacts() {
return false;
}
@Override
protected boolean shouldRedirectOutputDirectories() {
return false;
}
@Override
protected String getSrcName() {
return super.getSrcName() + "-instrumented";
}
@Override
protected String getSrcTestName() {
return super.getSrcTestName() + "-instrumented";
}
}