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 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.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.
*
* @goal setup
* @phase 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";
}
}