io.qameta.allure.maven.AlureAggregateMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of allure-maven Show documentation
Show all versions of allure-maven Show documentation
Maven integration with Allure reporting
package io.qameta.allure.maven;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @author Dmitry Baev [email protected]
* Date: 04.08.15
*/
@Mojo(name = "aggregate", defaultPhase = LifecyclePhase.SITE,
inheritByDefault = false, aggregator = true)
public class AlureAggregateMojo extends AllureGenerateMojo {
/**
* The projects in the reactor.
*/
@Parameter(defaultValue = "${reactorProjects}", required = true, readonly = true)
private List reactorProjects;
/**
* {@inheritDoc}
*/
@Override
protected List getInputDirectories() {
Path relative = Paths.get(resultsDirectory);
if (relative.isAbsolute()) {
getLog().error("Input directory should be not absolute for aggregate goal.");
return Collections.emptyList();
}
List result = new ArrayList<>();
for (MavenProject child : reactorProjects) {
Path target = Paths.get(child.getBuild().getDirectory());
Path path = target.resolve(relative).toAbsolutePath();
if (isDirectoryExists(path)) {
result.add(path);
getLog().info("Found results directory " + path);
} else {
getLog().warn("Results directory for module " + child.getName() + " not found.");
}
}
return result;
}
@Override
protected String getMojoName() {
return "aggregate";
}
@Override
protected boolean isAggregate() {
return true;
}
}