io.qameta.allure.maven.AllureReportMojo 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 java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.List;
/**
* @author Dmitry Baev [email protected]
* Date: 30.07.15
*/
@Mojo(name = "report", defaultPhase = LifecyclePhase.SITE)
public class AllureReportMojo extends AllureGenerateMojo {
/**
* {@inheritDoc}
*/
@Override
protected List getInputDirectories() {
Path path = getInputDirectoryAbsolutePath();
if (isDirectoryExists(path)) {
getLog().info("Found results directory " + path);
return Collections.singletonList(path);
}
getLog().error("Directory " + path + " not found.");
return Collections.emptyList();
}
@Override
protected String getMojoName() {
return "report";
}
private Path getInputDirectoryAbsolutePath() {
Path path = Paths.get(resultsDirectory);
return path.isAbsolute() ? path : Paths.get(buildDirectory).resolve(path);
}
}