diff --git a/src/it/aggregate-third-party-report/postbuild.groovy b/src/it/aggregate-third-party-report/postbuild.groovy
index 187aa53e6..edc0f0813 100644
--- a/src/it/aggregate-third-party-report/postbuild.groovy
+++ b/src/it/aggregate-third-party-report/postbuild.groovy
@@ -20,7 +20,7 @@
* #L%
*/
-file = new File(basedir, 'target/site/aggregate-third-party-report.html');
+file = new File(basedir, 'target/reports/aggregate-third-party-report.html');
assert file.exists();
content = file.text;
assert !content.contains('the project has no dependencies.');
@@ -29,5 +29,5 @@ assert content.contains('common
assert content.contains('The Apache Software License, Version 2.0 | '); // TODO Should be a link
assert content.contains('Back to top');
-file = new File(basedir, 'target/site/third-party-report.html');
+file = new File(basedir, 'target/reports/third-party-report.html');
assert !file.exists();
diff --git a/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java b/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java
index 204edc322..15a6b096e 100644
--- a/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java
+++ b/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java
@@ -46,8 +46,8 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
diff --git a/src/main/java/org/codehaus/mojo/license/AbstractLicenseReportRenderer.java b/src/main/java/org/codehaus/mojo/license/AbstractLicenseReportRenderer.java
index cdb7d8f24..b90c33345 100644
--- a/src/main/java/org/codehaus/mojo/license/AbstractLicenseReportRenderer.java
+++ b/src/main/java/org/codehaus/mojo/license/AbstractLicenseReportRenderer.java
@@ -61,8 +61,7 @@ public abstract class AbstractLicenseReportRenderer extends AbstractMavenReportR
*/
protected final String bundleName;
- public AbstractLicenseReportRenderer(
- org.apache.maven.doxia.sink.Sink sink, String bundleName, I18N i18n, Locale locale) {
+ public AbstractLicenseReportRenderer(Sink sink, String bundleName, I18N i18n, Locale locale) {
super(sink);
this.bundleName = bundleName;
this.i18n = i18n;
@@ -114,44 +113,6 @@ protected String getGAV(ThirdPartyDetails details) {
return ArtifactUtils.versionlessKey(details.getGroupId(), details.getArtifactId()) + ":" + details.getVersion();
}
- protected void renderThirdPartySummaryTableHeader() {
- renderThirdPartySummaryTableHeader(true, true, true);
- }
-
- protected void renderThirdPartySummaryTableHeader(
- boolean includeScope, boolean includeClassifier, boolean includeType) {
- sink.tableRow();
- sinkHeaderCellText(getText("report.status"));
- sinkHeaderCellText(getText("report.gav"));
- // sink.tableHeaderCell();
- // sink.text( getText( "report.artifactId" ) );
- // sink.tableHeaderCell_();
- // sink.tableHeaderCell();
- // sink.text( getText( "report.version" ) );
- // sink.tableHeaderCell_();
- if (includeScope) {
- sinkHeaderCellText(getText("report.scope"));
- }
- if (includeClassifier) {
- sinkHeaderCellText(getText("report.classifier"));
- }
- if (includeType) {
- sinkHeaderCellText(getText("report.type"));
- }
- sinkHeaderCellText(getText("report.licenses"));
- sink.tableRow_();
- }
-
- protected void renderThirdPartySummaryTableRow(ThirdPartyDetails details) {
- renderThirdPartySummaryTableRow(details, true, true, true);
- }
-
- protected void sinkHeaderCellText(String text) {
- sink.tableHeaderCell();
- sink.text(text);
- sink.tableHeaderCell_();
- }
-
protected void sinkHeaderCellText(String width, String text) {
SinkEventAttributes attrs = new SinkEventAttributeSet();
@@ -170,14 +131,7 @@ protected void sinkCellText(String width, String text) {
sink.tableCell_();
}
- protected void sinkCellText(String text) {
- sink.tableCell();
- sink.text(text);
- sink.tableCell_();
- }
-
- protected void renderThirdPartySummaryTableRow(
- ThirdPartyDetails details, boolean includeScope, boolean includeClassifier, boolean includeType) {
+ protected void renderThirdPartySummaryTableRow(ThirdPartyDetails details) {
sink.tableRow();
sink.tableCell();
if (details.hasPomLicenses()) {
@@ -187,26 +141,20 @@ protected void renderThirdPartySummaryTableRow(
} else {
renderErrorIcon();
}
+ sink.tableCell_();
sink.tableCell();
String gav = getGAV(details);
sink.link("#" + gav);
sink.text(gav);
sink.link_();
-
sink.tableCell_();
- if (includeScope) {
- sinkCellText(details.getScope());
- }
- if (includeClassifier) {
- sinkCellText(details.getClassifier());
- }
- if (includeType) {
- sinkCellText(details.getType());
- }
- sink.tableCell();
+ tableCell(details.getScope());
+ tableCell(details.getClassifier());
+ tableCell(details.getType());
+ sink.tableCell();
if (details.hasLicenses()) {
String[] licenses = details.getLicenses();
for (int i = 0; i < licenses.length; i++) {
@@ -223,52 +171,11 @@ protected void renderThirdPartySummaryTableRow(
sink.tableRow_();
}
- protected void safeBold() {
- try {
- sink.bold();
- } catch (NoSuchMethodError e) {
- // ignore Maven 2.1.0
- }
- }
-
- // CHECKSTYLE_OFF: MethodName
- protected void safeBold_() {
- // CHECKSTYLE_ON: MethodName
- try {
- sink.bold_();
- } catch (NoSuchMethodError e) {
- // ignore Maven 2.1.0
- }
- }
-
- protected void safeItalic() {
- try {
- sink.italic();
- } catch (NoSuchMethodError e) {
- // ignore Maven 2.1.0
- }
- }
-
- // CHECKSTYLE_OFF: MethodName
- protected void safeItalic_() {
- // CHECKSTYLE_ON: MethodName
- try {
- sink.italic_();
- } catch (NoSuchMethodError e) {
- // ignore Maven 2.1.0
- }
- }
-
protected void renderThirdPartyDetailTable(ThirdPartyDetails details) {
- renderThirdPartyDetailTable(details, true, true, true);
- }
-
- protected void renderThirdPartyDetailTable(
- ThirdPartyDetails details, boolean includeScope, boolean includeClassifier, boolean includeType) {
final String cellWidth = "80%";
final String headerWidth = "20%";
- sink.table();
- sink.tableRows(new int[] {Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_LEFT}, false);
+ startTable(new int[] {Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_LEFT}, false);
+
sink.tableRow();
sinkHeaderCellText(headerWidth, getText("report.status"));
SinkEventAttributes attrs = new SinkEventAttributeSet();
@@ -295,24 +202,21 @@ protected void renderThirdPartyDetailTable(
sinkCellText(cellWidth, getGAV(details));
sink.tableRow_();
- if (includeScope) {
- sink.tableRow();
- sinkHeaderCellText(headerWidth, getText("report.scope"));
- sinkCellText(cellWidth, details.getScope());
- sink.tableRow_();
- }
- if (includeClassifier) {
- sink.tableRow();
- sinkHeaderCellText(headerWidth, getText("report.classifier"));
- sinkCellText(cellWidth, details.getClassifier());
- sink.tableRow_();
- }
- if (includeType) {
- sink.tableRow();
- sinkHeaderCellText(headerWidth, getText("report.type"));
- sinkCellText(cellWidth, details.getType());
- sink.tableRow_();
- }
+ sink.tableRow();
+ sinkHeaderCellText(headerWidth, getText("report.scope"));
+ sinkCellText(cellWidth, details.getScope());
+ sink.tableRow_();
+
+ sink.tableRow();
+ sinkHeaderCellText(headerWidth, getText("report.classifier"));
+ sinkCellText(cellWidth, details.getClassifier());
+ sink.tableRow_();
+
+ sink.tableRow();
+ sinkHeaderCellText(headerWidth, getText("report.type"));
+ sinkCellText(cellWidth, details.getType());
+ sink.tableRow_();
+
String[] licenses = details.getLicenses();
if (details.hasPomLicenses()) {
@@ -346,39 +250,22 @@ protected void renderThirdPartyDetailTable(
sinkCellText(cellWidth, getText("report.no.license"));
sink.tableRow_();
}
- sink.tableRows_();
- sink.table_();
+ endTable();
}
protected void renderThirdPartySummaryTable(Collection collection) {
- renderThirdPartySummaryTable(collection, true, true, true);
- }
-
- protected void renderThirdPartySummaryTable(
- Collection collection,
- boolean includeScope,
- boolean includeClassifier,
- boolean includeType) {
- sink.table();
- sink.tableRows(null, false);
- renderThirdPartySummaryTableHeader(includeScope, includeClassifier, includeType);
+ startTable();
+ tableHeader(new String[] {
+ getText("report.status"),
+ getText("report.gav"),
+ getText("report.scope"),
+ getText("report.classifier"),
+ getText("report.type"),
+ getText("report.licenses")
+ });
for (ThirdPartyDetails details : collection) {
- renderThirdPartySummaryTableRow(details, includeScope, includeClassifier, includeType);
+ renderThirdPartySummaryTableRow(details);
}
- renderThirdPartySummaryTableHeader(includeScope, includeClassifier, includeType);
- sink.tableRows_();
- sink.table_();
- }
-
- protected void renderPropertySummaryTableHeader() {
- sink.tableRow();
- sinkHeaderCellText(getText("report.status"));
- sinkHeaderCellText(getText("report.property"));
- sinkHeaderCellText(getText("report.currentVersion"));
- sinkHeaderCellText(getText("report.nextVersion"));
- sinkHeaderCellText(getText("report.nextIncremental"));
- sinkHeaderCellText(getText("report.nextMinor"));
- sinkHeaderCellText(getText("report.nextMajor"));
- sink.tableRow_();
+ endTable();
}
}
diff --git a/src/main/java/org/codehaus/mojo/license/AbstractThirdPartyReportMojo.java b/src/main/java/org/codehaus/mojo/license/AbstractThirdPartyReport.java
similarity index 99%
rename from src/main/java/org/codehaus/mojo/license/AbstractThirdPartyReportMojo.java
rename to src/main/java/org/codehaus/mojo/license/AbstractThirdPartyReport.java
index 401ec2f36..adb6e93a7 100644
--- a/src/main/java/org/codehaus/mojo/license/AbstractThirdPartyReportMojo.java
+++ b/src/main/java/org/codehaus/mojo/license/AbstractThirdPartyReport.java
@@ -71,9 +71,9 @@
* @author tchemit dev@tchemit.fr
* @since 1.1
*/
-public abstract class AbstractThirdPartyReportMojo extends AbstractMavenReport
+public abstract class AbstractThirdPartyReport extends AbstractMavenReport
implements MavenProjectDependenciesConfigurator {
- private static final Logger LOG = LoggerFactory.getLogger(AbstractThirdPartyReportMojo.class);
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractThirdPartyReport.class);
// ----------------------------------------------------------------------
// Mojo Parameters
diff --git a/src/main/java/org/codehaus/mojo/license/AggregatorThirdPartyReportMojo.java b/src/main/java/org/codehaus/mojo/license/AggregatorThirdPartyReport.java
similarity index 84%
rename from src/main/java/org/codehaus/mojo/license/AggregatorThirdPartyReportMojo.java
rename to src/main/java/org/codehaus/mojo/license/AggregatorThirdPartyReport.java
index 4b08a5a17..4f2e61936 100644
--- a/src/main/java/org/codehaus/mojo/license/AggregatorThirdPartyReportMojo.java
+++ b/src/main/java/org/codehaus/mojo/license/AggregatorThirdPartyReport.java
@@ -25,10 +25,7 @@
import java.io.IOException;
import java.util.Collection;
import java.util.LinkedHashSet;
-import java.util.List;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
@@ -36,7 +33,6 @@
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.codehaus.mojo.license.api.DependenciesToolException;
import org.codehaus.mojo.license.api.ThirdPartyDetails;
import org.codehaus.mojo.license.api.ThirdPartyToolException;
@@ -50,7 +46,7 @@
* @since 1.10
*/
@Mojo(name = "aggregate-third-party-report", aggregator = true, requiresDependencyResolution = ResolutionScope.TEST)
-public class AggregatorThirdPartyReportMojo extends AbstractThirdPartyReportMojo {
+public class AggregatorThirdPartyReport extends AbstractThirdPartyReport {
// ----------------------------------------------------------------------
// Mojo Parameters
@@ -77,14 +73,6 @@ public class AggregatorThirdPartyReportMojo extends AbstractThirdPartyReportMojo
defaultValue = "true")
private boolean executeOnlyOnRootModule;
- /**
- * The projects in the reactor.
- *
- * @since 1.10
- */
- @Parameter(property = "reactorProjects", readonly = true, required = true)
- private List reactorProjects;
-
// ----------------------------------------------------------------------
// MavenReport Implementaton
// ----------------------------------------------------------------------
@@ -106,7 +94,7 @@ public boolean canGenerateReport() {
}
// ----------------------------------------------------------------------
- // AbstractThirdPartyReportMojo Implementation
+ // AbstractThirdPartyReport Implementation
// ----------------------------------------------------------------------
/**
@@ -114,7 +102,6 @@ public boolean canGenerateReport() {
*/
protected Collection createThirdPartyDetails()
throws IOException, ThirdPartyToolException, ProjectBuildingException, MojoFailureException,
- InvalidDependencyVersionException, ArtifactNotFoundException, ArtifactResolutionException,
DependenciesToolException, MojoExecutionException {
Collection details = new LinkedHashSet<>();
diff --git a/src/main/java/org/codehaus/mojo/license/ThirdPartyReportMojo.java b/src/main/java/org/codehaus/mojo/license/ThirdPartyReport.java
similarity index 95%
rename from src/main/java/org/codehaus/mojo/license/ThirdPartyReportMojo.java
rename to src/main/java/org/codehaus/mojo/license/ThirdPartyReport.java
index 870cd48ae..52e7f1497 100644
--- a/src/main/java/org/codehaus/mojo/license/ThirdPartyReportMojo.java
+++ b/src/main/java/org/codehaus/mojo/license/ThirdPartyReport.java
@@ -42,7 +42,7 @@
* @since 1.1
*/
@Mojo(name = "third-party-report", requiresDependencyResolution = ResolutionScope.TEST)
-public class ThirdPartyReportMojo extends AbstractThirdPartyReportMojo {
+public class ThirdPartyReport extends AbstractThirdPartyReport {
// ----------------------------------------------------------------------
// Mojo Parameters
@@ -73,7 +73,7 @@ public boolean canGenerateReport() {
}
// ----------------------------------------------------------------------
- // AbstractThirdPartyReportMojo Implementation
+ // AbstractThirdPartyReport Implementation
// ----------------------------------------------------------------------
/**
diff --git a/src/main/java/org/codehaus/mojo/license/ThirdPartyReportRenderer.java b/src/main/java/org/codehaus/mojo/license/ThirdPartyReportRenderer.java
index d34c3e949..8a7d357d1 100644
--- a/src/main/java/org/codehaus/mojo/license/ThirdPartyReportRenderer.java
+++ b/src/main/java/org/codehaus/mojo/license/ThirdPartyReportRenderer.java
@@ -81,29 +81,21 @@ protected Collection getThirdPartiesNoLicense() {
*/
protected void renderBody() {
- sink.section1();
- sink.sectionTitle1();
- sink.text(getText("report.overview.title"));
- sink.sectionTitle1_();
- sink.paragraph();
- sink.text(getText("report.overview.text"));
- sink.paragraph_();
+ startSection(getText("report.overview.title"));
+ paragraph(getText("report.overview.text"));
renderSummaryTotalsTable(details);
- renderSummaryTable("report.overview.thirdParty", details, "report.overview.nothirdParty");
+ renderSummaryTable(details);
- sink.section1_();
+ endSection();
Collection dependencies;
// With no licenses dependencies
dependencies = getThirdPartiesNoLicense();
- sink.section1();
- sink.sectionTitle1();
- sink.text(getText("report.detail.title.noLicense"));
- sink.sectionTitle1_();
+ startSection(getText("report.detail.title.noLicense"));
sink.paragraph();
sink.text(getText("report.detail.text.noLicense"));
if (CollectionUtils.isEmpty(dependencies)) {
@@ -115,15 +107,12 @@ protected void renderBody() {
for (final ThirdPartyDetails detail : dependencies) {
renderThirdPartyDetail(detail);
}
- sink.section1_();
+ endSection();
// With third-party licenses dependencies
dependencies = getThirdPartiesThirdPartyLicense();
- sink.section1();
- sink.sectionTitle1();
- sink.text(getText("report.detail.title.thirdPartyLicense"));
- sink.sectionTitle1_();
+ startSection(getText("report.detail.title.thirdPartyLicense"));
sink.paragraph();
sink.text(getText("report.detail.text.thirdPartyLicense"));
if (CollectionUtils.isEmpty(dependencies)) {
@@ -135,15 +124,12 @@ protected void renderBody() {
for (final ThirdPartyDetails detail : dependencies) {
renderThirdPartyDetail(detail);
}
- sink.section1_();
+ endSection();
// With no pom dependencies
dependencies = getThirdPartiesPomLicense();
- sink.section1();
- sink.sectionTitle1();
- sink.text(getText("report.detail.title.pomLicense"));
- sink.sectionTitle1_();
+ startSection(getText("report.detail.title.pomLicense"));
sink.paragraph();
sink.text(getText("report.detail.text.pomLicense"));
if (CollectionUtils.isEmpty(dependencies)) {
@@ -155,7 +141,7 @@ protected void renderBody() {
for (final ThirdPartyDetails detail : dependencies) {
renderThirdPartyDetail(detail);
}
- sink.section1_();
+ endSection();
}
private void renderSummaryTotalsTable(Collection allThirdParties) {
@@ -171,71 +157,61 @@ private void renderSummaryTotalsTable(Collection allThirdPart
numWithNoLicense++;
}
}
- sink.table();
- sink.tableRows(null, false);
+ startTable();
sink.tableRow();
sink.tableCell();
renderInfoIcon();
sink.tableCell_();
- sinkCellText(getText("report.overview.numThirdParties"));
- sinkCellText(Integer.toString(allThirdParties.size()));
+ tableCell(getText("report.overview.numThirdParties"));
+ tableCell(Integer.toString(allThirdParties.size()));
sink.tableRow_();
sink.tableRow();
sink.tableCell();
renderSuccessIcon();
sink.tableCell_();
- sinkCellText(getText("report.overview.numWithPomLicenses"));
- sinkCellText(Integer.toString(numWithPomLicense));
+ tableCell(getText("report.overview.numWithPomLicenses"));
+ tableCell(Integer.toString(numWithPomLicense));
sink.tableRow_();
sink.tableRow();
sink.tableCell();
renderWarningIcon();
sink.tableCell_();
- sinkCellText(getText("report.overview.numWithThirdPartyLicenses"));
- sinkCellText(Integer.toString(numWithThirdPartyLicense));
+ tableCell(getText("report.overview.numWithThirdPartyLicenses"));
+ tableCell(Integer.toString(numWithThirdPartyLicense));
sink.tableRow_();
sink.tableRow();
sink.tableCell();
renderErrorIcon();
sink.tableCell_();
- sinkCellText(getText("report.overview.numWithNoLicense"));
- sinkCellText(Integer.toString(numWithNoLicense));
+ tableCell(getText("report.overview.numWithNoLicense"));
+ tableCell(Integer.toString(numWithNoLicense));
sink.tableRow_();
- sink.tableRows_();
- sink.table_();
+ endTable();
}
- private void renderSummaryTable(String titleKey, Collection contents, String emptyKey) {
- sink.section2();
- sink.sectionTitle2();
- sink.text(getText(titleKey));
- sink.sectionTitle2_();
+ private void renderSummaryTable(Collection contents) {
+ startSection(getText("report.overview.thirdParty"));
if (contents.isEmpty()) {
- sink.paragraph();
- sink.text(getText(emptyKey));
- sink.paragraph_();
+ paragraph(getText("report.overview.nothirdParty"));
} else {
renderThirdPartySummaryTable(contents);
}
- sink.section2_();
+ endSection();
}
private void renderThirdPartyDetail(ThirdPartyDetails detail) {
- sink.section2();
- sink.sectionTitle2();
- sink.text(getGAV(detail));
- sink.sectionTitle2_();
+ startSection(getGAV(detail));
renderThirdPartyDetailTable(detail);
sink.link("#" + getText("report.overview.title"));
sink.text(getText("report.back.to.top.page"));
sink.link_();
sink.lineBreak();
- sink.section2_();
+ endSection();
}
}
diff --git a/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseList.java b/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseList.java
index 2f13af840..196c97fd7 100644
--- a/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseList.java
+++ b/src/main/java/org/codehaus/mojo/license/spdx/SpdxLicenseList.java
@@ -29,7 +29,7 @@
import java.util.TreeMap;
import java.util.regex.Pattern;
-import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang3.StringEscapeUtils;
import org.codehaus.mojo.license.spdx.SpdxLicenseList.Attachments.ContentSanitizer;
import org.codehaus.mojo.license.spdx.SpdxLicenseList.Attachments.UrlReplacement;