use of org.apache.maven.model.ReportPlugin in project maven-plugins by apache.
the class CheckPluginDocumentationMojo method checkConfiguredReportPlugins.
/**
* Checks the project configured plugins if the required report plugins are present.
*
* @param project MavenProject to check
* @param reporter listener
* @todo maybe this should be checked default for all project?
*/
private void checkConfiguredReportPlugins(MavenProject project, DocumentationReporter reporter) {
List<String> expectedPlugins = getRequiredPlugins();
@SuppressWarnings("unchecked") List<ReportPlugin> reportPlugins = project.getReportPlugins();
if (reportPlugins != null && reportPlugins.size() > 0) {
for (ReportPlugin plugin : reportPlugins) {
expectedPlugins.remove(plugin.getArtifactId());
}
} else {
reporter.error("pom.xml has no report plugins configured.");
}
for (String expectedPlugin : expectedPlugins) {
reporter.error("pom.xml is missing the report plugin: " + expectedPlugin + ".");
}
}
use of org.apache.maven.model.ReportPlugin in project maven-plugins by apache.
the class AbstractPmdReport method constructXRefLocation.
protected String constructXRefLocation(boolean test) {
String location = null;
if (linkXRef) {
File xrefLoc = test ? xrefTestLocation : xrefLocation;
String relativePath = PathTool.getRelativePath(outputDirectory.getAbsolutePath(), xrefLoc.getAbsolutePath());
if (StringUtils.isEmpty(relativePath)) {
relativePath = ".";
}
relativePath = relativePath + "/" + xrefLoc.getName();
if (xrefLoc.exists()) {
// XRef was already generated by manual execution of a lifecycle binding
location = relativePath;
} else {
// Not yet generated - check if the report is on its way
@SuppressWarnings("unchecked") List<ReportPlugin> reportPlugins = project.getReportPlugins();
for (ReportPlugin plugin : reportPlugins) {
String artifactId = plugin.getArtifactId();
if ("maven-jxr-plugin".equals(artifactId) || "jxr-maven-plugin".equals(artifactId)) {
location = relativePath;
}
}
}
if (location == null) {
getLog().warn("Unable to locate Source XRef to link to - DISABLED");
}
}
return location;
}
use of org.apache.maven.model.ReportPlugin in project maven-plugins by apache.
the class PdfMojo method generateMavenReports.
/**
* Generate all Maven reports defined in <code>${project.reporting}</code> part
* only if <code>generateReports</code> is enabled.
*
* @param locale not null
* @throws MojoExecutionException if any
* @throws IOException if any
* @since 1.1
*/
private void generateMavenReports(Locale locale) throws MojoExecutionException, IOException {
if (!includeReports) {
getLog().info("Skipped report generation.");
return;
}
if (project.getReporting() == null) {
getLog().info("No report was specified.");
return;
}
for (final ReportPlugin reportPlugin : project.getReporting().getPlugins()) {
final PluginDescriptor pluginDescriptor = getPluginDescriptor(reportPlugin);
if (pluginDescriptor != null) {
List<String> goals = new ArrayList<String>(8);
for (final ReportSet reportSet : reportPlugin.getReportSets()) {
for (String goal : reportSet.getReports()) {
goals.add(goal);
}
}
List mojoDescriptors = pluginDescriptor.getMojos();
for (Object mojoDescriptor1 : mojoDescriptors) {
final MojoDescriptor mojoDescriptor = (MojoDescriptor) mojoDescriptor1;
if (goals.isEmpty() || (!goals.isEmpty() && goals.contains(mojoDescriptor.getGoal()))) {
MavenReport report = getMavenReport(mojoDescriptor);
generateMavenReport(report, mojoDescriptor.getPluginDescriptor().getPluginArtifact(), locale);
}
}
}
}
// generate project-info report
if (!getGeneratedMavenReports(locale).isEmpty()) {
File outDir = new File(getGeneratedSiteDirectoryTmp(), "xdoc");
if (!locale.getLanguage().equals(defaultLocale.getLanguage())) {
outDir = new File(new File(getGeneratedSiteDirectoryTmp(), locale.getLanguage()), "xdoc");
}
outDir.mkdirs();
File piReport = new File(outDir, "project-info.xml");
StringWriter sw = new StringWriter();
PdfSink sink = new PdfSink(sw);
ProjectInfoRenderer r = new ProjectInfoRenderer(sink, getGeneratedMavenReports(locale), i18n, locale);
r.render();
writeGeneratedReport(sw.toString(), piReport);
}
// copy generated site
copySiteDir(getGeneratedSiteDirectoryTmp(), getSiteDirectoryTmp());
copySiteDir(generatedSiteDirectory, getSiteDirectoryTmp());
}
use of org.apache.maven.model.ReportPlugin in project maven-plugins by apache.
the class MinMavenProjectStub method getReportPlugins.
/** {@inheritDoc} */
public List<ReportPlugin> getReportPlugins() {
ReportPlugin jxrPlugin = new ReportPlugin();
jxrPlugin.setArtifactId("maven-jxr-plugin");
return Collections.singletonList(jxrPlugin);
}
use of org.apache.maven.model.ReportPlugin in project maven-plugins by apache.
the class MultiMavenProjectStub method getReportPlugins.
/** {@inheritDoc} */
public List<ReportPlugin> getReportPlugins() {
ReportPlugin jxrPlugin = new ReportPlugin();
jxrPlugin.setArtifactId("maven-jxr-plugin");
return Collections.singletonList(jxrPlugin);
}
Aggregations