use of org.apache.maven.tools.plugin.extractor.ExtractionException in project maven-plugins by apache.
the class CheckPluginDocumentationMojo method checkPackagingSpecificDocumentation.
protected void checkPackagingSpecificDocumentation(MavenProject project, DocumentationReporter reporter) {
PluginDescriptor descriptor = new PluginDescriptor();
try {
mojoScanner.populatePluginDescriptor(project, descriptor);
} catch (InvalidPluginDescriptorException e) {
reporter.error("Failed to parse mojo descriptors.\nError: " + e.getMessage());
descriptor = null;
} catch (ExtractionException e) {
reporter.error("Failed to parse mojo descriptors.\nError: " + e.getMessage());
descriptor = null;
}
if (descriptor != null) {
@SuppressWarnings("unchecked") List<MojoDescriptor> mojos = descriptor.getMojos();
// ensure that all mojo classes are documented
if (mojos != null && !mojos.isEmpty()) {
for (MojoDescriptor mojo : mojos) {
String mojoDescription = mojo.getDescription();
if (mojoDescription == null || mojoDescription.trim().length() < MIN_DESCRIPTION_LENGTH) {
reporter.error("Mojo: \'" + mojo.getGoal() + "\' is missing a description.");
}
@SuppressWarnings("unchecked") List<Parameter> params = mojo.getParameters();
// ensure that all parameters are documented
if (params != null && !params.isEmpty()) {
for (Parameter param : params) {
if (param.getRequirement() == null && param.isEditable()) {
String paramDescription = param.getDescription();
if (paramDescription == null || paramDescription.trim().length() < MIN_DESCRIPTION_LENGTH) {
reporter.error("Parameter: \'" + param.getName() + "\' in mojo: \'" + mojo.getGoal() + "\' is missing a description.");
}
}
}
}
}
}
}
checkConfiguredReportPlugins(project, reporter);
checkProjectSite(project, reporter);
}
Aggregations