com.atlassian.maven.plugin.clover.internal.lifecycle.Maven3LifecycleAnalyzer 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.internal.lifecycle;
import com.atlassian.clover.api.CloverException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.LifecycleExecutor;
import org.apache.maven.lifecycle.MavenExecutionPlan;
import org.apache.maven.project.MavenProject;
import org.jetbrains.annotations.NotNull;
import java.util.Set;
public class Maven3LifecycleAnalyzer extends MavenLifecycleAnalyzer {
public Maven3LifecycleAnalyzer(@NotNull final LifecycleExecutor lifecycleExecutor,
@NotNull final MavenProject mavenProject,
@NotNull final MavenSession mavenSession) {
super(lifecycleExecutor, mavenProject, mavenSession);
}
@Override
public boolean isCompatibleVersion() {
return true;
}
@Override
public Set getPhasesToBeExecuted() throws CloverException {
try {
final String[] tasks = mavenSession.getGoals().toArray(new String[0]);
final MavenExecutionPlan plan = lifecycleExecutor.calculateExecutionPlan(mavenSession, tasks);
return getPhasesFromMojoExecutions(plan.getMojoExecutions());
} catch (Exception ex) {
throw new CloverException(ex);
}
}
}