diff --git a/pom.xml b/pom.xml index 0993af786d..38fa8ab503 100644 --- a/pom.xml +++ b/pom.xml @@ -104,7 +104,7 @@ scm:git:https://github.com/mojohaus/versions.git scm:git:ssh://git@github.com/mojohaus/versions.git - 2.15.0 + HEAD https://github.com/mojohaus/versions/tree/master @@ -120,8 +120,12 @@ 3.6.3 - 1.12.0 - 1.11.1 + + 2.0.0 + 2.0.0 + 4.0.0 + 4.0.0 + 4.11.0 7.1.0 4.2.2 @@ -134,8 +138,10 @@ 2.1.0 2.0.0 1.15.10 + 1.4.1 + 0.3.4 ${project.build.directory}/staging/versions @@ -214,10 +220,16 @@ org.eclipse.sisu org.eclipse.sisu.plexus - - 0.3.4 + ${sisuVersion} provided + + org.eclipse.sisu + org.eclipse.sisu.inject + ${sisuVersion} + + runtime + org.apache.maven.enforcer @@ -228,24 +240,18 @@ org.apache.maven.reporting maven-reporting-api - 3.1.1 + ${reportingApiVersion} org.apache.maven.reporting maven-reporting-impl - 3.2.0 + ${reportingImplVersion} org.apache.maven.doxia doxia-core ${doxiaVersion} - - - org.codehaus.plexus - plexus-container-default - - org.apache.maven.doxia @@ -254,26 +260,21 @@ - org.apache.maven.doxia - doxia-site-renderer - ${doxia-sitetoolsVersion} + org.codehaus.plexus + plexus-i18n + 1.0-beta-10 org.codehaus.plexus - plexus-container-default + plexus-component-api + org.apache.maven.doxia doxia-integration-tools ${doxia-sitetoolsVersion} - - - org.codehaus.plexus - plexus-container-default - - @@ -359,11 +360,6 @@ commons-io 2.17.0 - - dom4j - dom4j - 1.6.1 - org.codehaus.plexus plexus-archiver @@ -392,11 +388,6 @@ wagon-provider-api 3.5.3 - - org.apache.maven.doxia - doxia-decoration-model - 1.11.1 - diff --git a/versions-enforcer/pom.xml b/versions-enforcer/pom.xml index 403baa6207..dc87966861 100644 --- a/versions-enforcer/pom.xml +++ b/versions-enforcer/pom.xml @@ -132,7 +132,7 @@ run-its diff --git a/versions-maven-plugin/pom.xml b/versions-maven-plugin/pom.xml index 7484f76d81..a9dd430255 100644 --- a/versions-maven-plugin/pom.xml +++ b/versions-maven-plugin/pom.xml @@ -88,31 +88,18 @@ - org.apache.maven.reporting - maven-reporting-api + org.apache.maven.shared + maven-common-artifact-filters + org.apache.maven.reporting - maven-reporting-impl - - - org.apache.maven - maven-artifact - - - org.apache.maven - maven-core - - - org.apache.maven - maven-plugin-api - - + maven-reporting-api - org.apache.maven.shared - maven-common-artifact-filters + org.apache.maven.reporting + maven-reporting-impl @@ -125,20 +112,9 @@ doxia-sink-api - - org.apache.maven.doxia - doxia-site-renderer - - - org.apache.maven - maven-artifact - - - xml-apis - xml-apis - - + org.codehaus.plexus + plexus-i18n @@ -326,7 +302,7 @@ run-its diff --git a/versions-maven-plugin/src/it/it-823-ranges-update-report-001/verify.groovy b/versions-maven-plugin/src/it/it-823-ranges-update-report-001/verify.groovy index 4c558ea25a..f539c8bfbe 100644 --- a/versions-maven-plugin/src/it/it-823-ranges-update-report-001/verify.groovy +++ b/versions-maven-plugin/src/it/it-823-ranges-update-report-001/verify.groovy @@ -1,5 +1,5 @@ -propertyUpdatesReport = new File( basedir, "target/site/property-updates-report.html" ).text +propertyUpdatesReport = new File( basedir, "target/reports/property-updates-report.html" ).text .replaceAll( '<[^>]+>', ' ' ) .replaceAll( '&[^;]+;', ' ' ) .replaceAll( '\\s+', ' ' ) @@ -12,7 +12,7 @@ assert propertyUpdatesReport =~ / \[1\.1\.2,3\.0\] 1\.1\.3 1\.3 3/ assert propertyUpdatesReport =~ /Newer versions 1\.1\.3 Latest Incremental/ assert propertyUpdatesReport =~ /\b1\.2\.2 1\.3 Latest Minor 2\.0 2\.1 3\.0\b/ -dependencyUpdatesReport = new File( basedir, "target/site/dependency-updates-report.html" ).text +dependencyUpdatesReport = new File( basedir, "target/reports/dependency-updates-report.html" ).text .replaceAll( '<[^>]+>', ' ' ) .replaceAll( '&[^;]+;', ' ' ) .replaceAll( '\\s+', ' ' ) diff --git a/versions-maven-plugin/src/it/it-823-ranges-update-report-002/verify.groovy b/versions-maven-plugin/src/it/it-823-ranges-update-report-002/verify.groovy index c0bf5442e3..5006208a33 100644 --- a/versions-maven-plugin/src/it/it-823-ranges-update-report-002/verify.groovy +++ b/versions-maven-plugin/src/it/it-823-ranges-update-report-002/verify.groovy @@ -1,5 +1,5 @@ -propertyUpdatesReport = new File( basedir, "target/site/property-updates-report.html" ).text +propertyUpdatesReport = new File( basedir, "target/reports/property-updates-report.html" ).text .replaceAll( '<[^>]+>', ' ' ) .replaceAll( '&[^;]+;', ' ' ) .replaceAll( '\\s+', ' ' ) @@ -12,7 +12,7 @@ assert propertyUpdatesReport =~ / \[1\.1\.2,3\.0\) 1\.1\.3 1\.3 3/ assert propertyUpdatesReport =~ /Newer versions 1\.1\.3 Latest Incremental/ assert propertyUpdatesReport =~ /\b1\.2\.2 1\.3 Latest Minor 2\.0 2\.1 \* 3\.0\b/ -dependencyUpdatesReport = new File( basedir, "target/site/dependency-updates-report.html" ).text +dependencyUpdatesReport = new File( basedir, "target/reports/dependency-updates-report.html" ).text .replaceAll( '<[^>]+>', ' ' ) .replaceAll( '&[^;]+;', ' ' ) .replaceAll( '\\s+', ' ' ) diff --git a/versions-maven-plugin/src/it/it-abstract-versions-report-001/verify.groovy b/versions-maven-plugin/src/it/it-abstract-versions-report-001/verify.groovy index c0633c5e32..2b89cf0866 100644 --- a/versions-maven-plugin/src/it/it-abstract-versions-report-001/verify.groovy +++ b/versions-maven-plugin/src/it/it-abstract-versions-report-001/verify.groovy @@ -1,4 +1,4 @@ -dependencyUpdatesReport = new File( basedir, "target/site/dependency-updates-report.html" ).text +dependencyUpdatesReport = new File( basedir, "target/reports/dependency-updates-report.html" ).text .replaceAll( '<[^>]+>', ' ' ) .replaceAll( '&[^;]+;', ' ' ) .replaceAll( '\\s+', ' ' ) @@ -7,7 +7,7 @@ dependencyUpdatesReport = new File( basedir, "target/site/dependency-updates-rep assert dependencyUpdatesReport =~ /\b1\.1\.0-2\b/ // current version of the dependency assert dependencyUpdatesReport =~ /\b3\.0\b/ // latest major available version -pluginUpdatesReport = new File( basedir, "target/site/plugin-updates-report.html" ).text +pluginUpdatesReport = new File( basedir, "target/reports/plugin-updates-report.html" ).text .replaceAll( '<[^>]+>', ' ' ) .replaceAll( '&[^;]+;', ' ' ) .replaceAll( '\\s+', ' ' ) diff --git a/versions-maven-plugin/src/it/it-aggregate-plugn-multiple-versions-same-plugin/verify.groovy b/versions-maven-plugin/src/it/it-aggregate-plugn-multiple-versions-same-plugin/verify.groovy index b47711ca60..ed89a47e93 100644 --- a/versions-maven-plugin/src/it/it-aggregate-plugn-multiple-versions-same-plugin/verify.groovy +++ b/versions-maven-plugin/src/it/it-aggregate-plugn-multiple-versions-same-plugin/verify.groovy @@ -17,10 +17,10 @@ * under the License. */ -def dependenciesUpgradeReport = new File( basedir, 'target/site/dependency-updates-aggregate-report.html') +def dependenciesUpgradeReport = new File( basedir, 'target/reports/dependency-updates-aggregate-report.html') assert dependenciesUpgradeReport.exists() -def pluginsUpgradeReport = new File( basedir, 'target/site/dependency-updates-aggregate-report.html') +def pluginsUpgradeReport = new File( basedir, 'target/reports/dependency-updates-aggregate-report.html') assert pluginsUpgradeReport.exists() \ No newline at end of file diff --git a/versions-maven-plugin/src/it/it-dependency-updates-report-issue-684-001/verify.groovy b/versions-maven-plugin/src/it/it-dependency-updates-report-issue-684-001/verify.groovy index cd8571e77a..e4b1af3042 100644 --- a/versions-maven-plugin/src/it/it-dependency-updates-report-issue-684-001/verify.groovy +++ b/versions-maven-plugin/src/it/it-dependency-updates-report-issue-684-001/verify.groovy @@ -1,2 +1,2 @@ -output = new File( basedir, "target/site/dependency-updates-report.html" ).text +output = new File( basedir, "target/reports/dependency-updates-report.html" ).text assert ! ( output =~ /\b3.0\b/ ) diff --git a/versions-maven-plugin/src/it/it-display-parent-updates-no-updates/invoker.properties b/versions-maven-plugin/src/it/it-display-parent-updates-no-updates/invoker.properties index 20d50bca88..d71819f43b 100644 --- a/versions-maven-plugin/src/it/it-display-parent-updates-no-updates/invoker.properties +++ b/versions-maven-plugin/src/it/it-display-parent-updates-no-updates/invoker.properties @@ -17,5 +17,5 @@ # under the License. # -invoker.goals = ${project.groupId}:${project.artifactId}:2.13.0:display-parent-updates +invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:display-parent-updates invoker.mavenOpts = -Dversions.outputFile=./output.txt -DoutputEncoding=UTF-8 diff --git a/versions-maven-plugin/src/it/it-plugin-updates-report-issue-684-001/verify.groovy b/versions-maven-plugin/src/it/it-plugin-updates-report-issue-684-001/verify.groovy index 1d0370e86f..8d54eac58f 100644 --- a/versions-maven-plugin/src/it/it-plugin-updates-report-issue-684-001/verify.groovy +++ b/versions-maven-plugin/src/it/it-plugin-updates-report-issue-684-001/verify.groovy @@ -1,4 +1,4 @@ -output = new File( basedir, 'target/site/plugin-updates-report.html' ).text +output = new File( basedir, 'target/reports/plugin-updates-report.html' ).text .replaceAll( '<[^>]+>', ' ' ) .replaceAll( '&[^;]+;', ' ' ) .replaceAll( '\\s+', ' ' ) diff --git a/versions-maven-plugin/src/it/it-property-updates-report-issue-684-001/verify.groovy b/versions-maven-plugin/src/it/it-property-updates-report-issue-684-001/verify.groovy index 1d0370e86f..8d54eac58f 100644 --- a/versions-maven-plugin/src/it/it-property-updates-report-issue-684-001/verify.groovy +++ b/versions-maven-plugin/src/it/it-property-updates-report-issue-684-001/verify.groovy @@ -1,4 +1,4 @@ -output = new File( basedir, 'target/site/plugin-updates-report.html' ).text +output = new File( basedir, 'target/reports/plugin-updates-report.html' ).text .replaceAll( '<[^>]+>', ' ' ) .replaceAll( '&[^;]+;', ' ' ) .replaceAll( '\\s+', ' ' ) diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractDependencyUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractDependencyUpdatesReport.java similarity index 95% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractDependencyUpdatesReportMojo.java rename to versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractDependencyUpdatesReport.java index a2a359b04a..6fcf886e66 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractDependencyUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractDependencyUpdatesReport.java @@ -55,7 +55,7 @@ /** * Generates a report of available updates for the dependencies of a project. */ -public abstract class AbstractDependencyUpdatesReportMojo extends AbstractVersionsReport { +public abstract class AbstractDependencyUpdatesReport extends AbstractVersionsReport { private static final DependencyComparator DEPENDENCY_COMPARATOR = DependencyComparator.INSTANCE; @@ -103,7 +103,7 @@ public abstract class AbstractDependencyUpdatesReportMojo extends AbstractVersio @Parameter(property = "onlyUpgradable", defaultValue = "false") protected boolean onlyUpgradable; - public AbstractDependencyUpdatesReportMojo( + protected AbstractDependencyUpdatesReport( I18N i18n, ArtifactHandlerManager artifactHandlerManager, RepositorySystem repositorySystem, @@ -115,6 +115,7 @@ public AbstractDependencyUpdatesReportMojo( /** * {@inheritDoc} */ + @Override public boolean isExternalReport() { return false; } @@ -122,6 +123,7 @@ public boolean isExternalReport() { /** * {@inheritDoc} */ + @Override public boolean canGenerateReport() { return true; } @@ -132,7 +134,7 @@ public boolean canGenerateReport() { * @param locale the locale to generate the report for. * @param sink the report formatting tool */ - @SuppressWarnings("deprecation") + @Override protected void doGenerateReport(Locale locale, Sink sink) throws MavenReportException { Set dependencies = getDependencies(); @@ -188,7 +190,7 @@ protected void doGenerateReport(Locale locale, Sink sink) throws MavenReportExce } protected void handleDependencyManagementTransitive( - MavenProject project, Set dependencyManagementCollector) throws MavenReportException { + MavenProject project, Set dependencyManagementCollector) { if (processDependencyManagementTransitive) { if (hasDependencyManagement(project)) { if (getLog().isDebugEnabled()) { @@ -242,7 +244,7 @@ private Set getDependencies() { } /** - * Implementations of {@link AbstractDependencyUpdatesReportMojo} may use this to supply the main processing logic + * Implementations of {@link AbstractDependencyUpdatesReport} may use this to supply the main processing logic * (see {@link #getDependencyManagement(Set)}) with desired dependency data, which will be used * in the creation of the report. * @@ -266,7 +268,7 @@ private Set getDependencyManagement(Set dependencies) th } /** - * Implementations of {@link AbstractDependencyUpdatesReportMojo} may use this to supply the main processing logic + * Implementations of {@link AbstractDependencyUpdatesReport} may use this to supply the main processing logic * (see {@link #getDependencyManagement(Set)}) with desired managed dependencies data, which will be used * in the creation of the report. * @@ -283,7 +285,7 @@ private void renderReport(Locale locale, Sink sink, DependencyUpdatesModel model for (String format : formats) { if ("html".equals(format)) { rendererFactory - .createReportRenderer(getOutputName(), sink, locale, model, allowSnapshots) + .createReportRenderer(getOutputPath(), sink, locale, model, allowSnapshots) .render(); } else if ("xml".equals(format)) { Path outputDir = Paths.get(getProject().getBuild().getDirectory()); @@ -294,7 +296,7 @@ private void renderReport(Locale locale, Sink sink, DependencyUpdatesModel model throw new MavenReportException("Could not create the output directory"); } } - Path outputFile = outputDir.resolve(getOutputName() + ".xml"); + Path outputFile = outputDir.resolve(getOutputPath() + ".xml"); new DependencyUpdatesXmlReportRenderer(model, outputFile, allowSnapshots).render(); } } @@ -322,11 +324,4 @@ protected boolean hasDependencyManagement(MavenProject project) { return project.getDependencyManagement() != null && project.getDependencyManagement().getDependencies() != null; } - - /** - * {@inheritDoc} - */ - public String getOutputName() { - return "dependency-updates-report"; - } } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPluginUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPluginUpdatesReport.java similarity index 93% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPluginUpdatesReportMojo.java rename to versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPluginUpdatesReport.java index 335576f6cc..eb5abfeaea 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPluginUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPluginUpdatesReport.java @@ -48,7 +48,7 @@ /** * Generates a report of available updates for the plugins of a project. */ -public abstract class AbstractPluginUpdatesReportMojo extends AbstractVersionsReport { +public abstract class AbstractPluginUpdatesReport extends AbstractVersionsReport { private static final PluginComparator PLUGIN_COMPARATOR = PluginComparator.INSTANCE; @@ -75,7 +75,7 @@ public abstract class AbstractPluginUpdatesReportMojo extends AbstractVersionsRe @Parameter(property = "onlyUpgradable", defaultValue = "false") protected boolean onlyUpgradable; - public AbstractPluginUpdatesReportMojo( + protected AbstractPluginUpdatesReport( I18N i18n, ArtifactHandlerManager artifactHandlerManager, RepositorySystem repositorySystem, @@ -87,6 +87,7 @@ public AbstractPluginUpdatesReportMojo( /** * {@inheritDoc} */ + @Override public boolean isExternalReport() { return false; } @@ -94,6 +95,7 @@ public boolean isExternalReport() { /** * {@inheritDoc} */ + @Override public boolean canGenerateReport() { return haveBuildPlugins(getProject()) || haveBuildPluginManagementPlugins(getProject()); } @@ -117,6 +119,7 @@ protected boolean haveBuildPlugins(MavenProject project) { * @param locale the locale to generate the report for. * @param sink the report formatting tool */ + @Override protected void doGenerateReport(Locale locale, Sink sink) throws MavenReportException { Set pluginManagement = getPluginManagement(); @@ -163,7 +166,7 @@ private Set getPluginManagement() { } /** - * Implementations of {@link AbstractPluginUpdatesReportMojo} may use this to supply the main processing logic + * Implementations of {@link AbstractPluginUpdatesReport} may use this to supply the main processing logic * with desired pluginManagement data, which will be used in the creation of the report. * * @param pluginManagementCollector, a set initialized with a {@link PluginComparator} comparator. @@ -184,7 +187,7 @@ private Set getPlugins() { } /** - * Implementations of {@link AbstractPluginUpdatesReportMojo} may use this to supply the main processing logic + * Implementations of {@link AbstractPluginUpdatesReport} may use this to supply the main processing logic * with desired build plugin information, which will be used to create the report. * *@param pluginsCollector, a set initialized with a {@link PluginComparator} comparator. @@ -195,7 +198,7 @@ private void renderReport(Locale locale, Sink sink, PluginUpdatesModel model) th for (String format : formats) { if ("html".equals(format)) { rendererFactory - .createReportRenderer(getOutputName(), sink, locale, model, allowSnapshots) + .createReportRenderer(getOutputPath(), sink, locale, model, allowSnapshots) .render(); } else if ("xml".equals(format)) { Path outputDir = Paths.get(getProject().getBuild().getDirectory()); @@ -206,7 +209,7 @@ private void renderReport(Locale locale, Sink sink, PluginUpdatesModel model) th throw new MavenReportException("Could not create the output directory"); } } - Path outputFile = outputDir.resolve(getOutputName() + ".xml"); + Path outputFile = outputDir.resolve(getOutputPath() + ".xml"); new PluginUpdatesXmlReportRenderer(model, outputFile, allowSnapshots).render(); } } @@ -224,9 +227,4 @@ private void handleOnlyProjectPlugins(Set pluginManagement, Set pmPlugin -> plugins.stream().noneMatch(plugin -> PLUGIN_COMPARATOR.compare(plugin, pmPlugin) == 0)); } } - - /** - * {@inheritDoc} - */ - public abstract String getOutputName(); } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPropertyUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPropertyUpdatesReport.java similarity index 92% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPropertyUpdatesReportMojo.java rename to versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPropertyUpdatesReport.java index 92e2fa980c..b789683a52 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPropertyUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractPropertyUpdatesReport.java @@ -46,7 +46,7 @@ * Generates a report of available updates for properties of a project which are linked to the dependencies and/or * plugins of a project. */ -public abstract class AbstractPropertyUpdatesReportMojo extends AbstractVersionsReport { +public abstract class AbstractPropertyUpdatesReport extends AbstractVersionsReport { private static final PropertyComparator PROPERTIES_COMPARATOR = PropertyComparator.INSTANCE; @@ -98,7 +98,7 @@ public abstract class AbstractPropertyUpdatesReportMojo extends AbstractVersions @Parameter(property = "propertyUpdatesReportFormats", defaultValue = "html") protected String[] formats = new String[] {"html"}; - public AbstractPropertyUpdatesReportMojo( + protected AbstractPropertyUpdatesReport( I18N i18n, ArtifactHandlerManager artifactHandlerManager, RepositorySystem repositorySystem, @@ -110,6 +110,7 @@ public AbstractPropertyUpdatesReportMojo( /** * {@inheritDoc} */ + @Override public boolean isExternalReport() { return false; } @@ -117,6 +118,7 @@ public boolean isExternalReport() { /** * {@inheritDoc} */ + @Override public boolean canGenerateReport() { return haveBuildProperties(); } @@ -128,7 +130,7 @@ protected boolean haveBuildProperties() { protected void doGenerateReport(Locale locale, Sink sink) throws MavenReportException { try { - final Map updateSet = new TreeMap<>(PROPERTIES_COMPARATOR); + final Map updateSet = new TreeMap<>(PROPERTIES_COMPARATOR); populateUpdateSet(updateSet); renderReport(locale, sink, getPropertyUpdatesModel(updateSet)); @@ -154,7 +156,7 @@ private void renderReport(Locale locale, Sink sink, PropertyUpdatesModel propert for (String format : this.formats) { if ("html".equals(format)) { this.rendererFactory - .createReportRenderer(getOutputName(), sink, locale, propertyUpdatesModel, allowSnapshots) + .createReportRenderer(getOutputPath(), sink, locale, propertyUpdatesModel, allowSnapshots) .render(); } else if ("xml".equals(format)) { Path outputDir = Paths.get(getProject().getBuild().getDirectory()); @@ -165,7 +167,7 @@ private void renderReport(Locale locale, Sink sink, PropertyUpdatesModel propert throw new MavenReportException("Could not create the output directory"); } } - Path outputFile = outputDir.resolve(getOutputName() + ".xml"); + Path outputFile = outputDir.resolve(getOutputPath() + ".xml"); new PropertyUpdatesXmlReportRenderer(propertyUpdatesModel, outputFile, allowSnapshots).render(); } } @@ -185,11 +187,4 @@ protected VersionPropertiesMapRequest getRequest(MavenProject project) { .withAutoLinkItems(this.autoLinkItems) .build(); } - - /** - * {@inheritDoc} - */ - public String getOutputName() { - return "property-updates-report"; - } } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsReport.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsReport.java index db398726e2..c2dfebaef1 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsReport.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsReport.java @@ -25,12 +25,9 @@ import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; import org.apache.maven.doxia.sink.Sink; -import org.apache.maven.doxia.siterenderer.Renderer; import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.MojoExecution; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; import org.apache.maven.reporting.AbstractMavenReport; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.wagon.Wagon; @@ -120,9 +117,6 @@ public abstract class AbstractVersionsReport extends AbstractMavenReport { @Parameter(defaultValue = "${session}", required = true, readonly = true) protected MavenSession session; - @Parameter(defaultValue = "${mojoExecution}", required = true, readonly = true) - private MojoExecution mojoExecution; - /** *

Allows specifying the {@linkplain RuleSet} object describing rules * on artifact versions to ignore when considering updates.

@@ -225,16 +219,6 @@ protected void executeReport(Locale locale) throws MavenReportException { protected abstract void doGenerateReport(Locale locale, Sink sink) throws MavenReportException, MojoExecutionException; - @Override - protected MavenProject getProject() { - return project; - } - - @Override - protected Renderer getSiteRenderer() { - return siteRenderer; - } - @Override public String getDescription(Locale locale) { return getText(locale, "report.description"); @@ -253,7 +237,7 @@ public String getName(Locale locale) { * @return the message. */ public String getText(Locale locale, String key) { - return i18n.getString(getOutputName(), locale, key); + return i18n.getString(getOutputPath(), locale, key); } public Boolean getAllowSnapshots() { diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesAggregateReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesAggregateReport.java similarity index 95% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesAggregateReportMojo.java rename to versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesAggregateReport.java index 14d2928a4d..efc92e5665 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesAggregateReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesAggregateReport.java @@ -44,10 +44,10 @@ requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true, aggregator = true) -public class DependencyUpdatesAggregateReportMojo extends AbstractDependencyUpdatesReportMojo { +public class DependencyUpdatesAggregateReport extends AbstractDependencyUpdatesReport { @Inject - protected DependencyUpdatesAggregateReportMojo( + protected DependencyUpdatesAggregateReport( I18N i18n, ArtifactHandlerManager artifactHandlerManager, RepositorySystem repositorySystem, diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReport.java similarity index 95% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReportMojo.java rename to versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReport.java index f9ee65b277..7427ee5d28 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DependencyUpdatesReport.java @@ -41,10 +41,10 @@ * @since 1.0-beta-1 */ @Mojo(name = "dependency-updates-report", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true) -public class DependencyUpdatesReportMojo extends AbstractDependencyUpdatesReportMojo { +public class DependencyUpdatesReport extends AbstractDependencyUpdatesReport { @Inject - protected DependencyUpdatesReportMojo( + protected DependencyUpdatesReport( I18N i18n, ArtifactHandlerManager artifactHandlerManager, RepositorySystem repositorySystem, @@ -80,6 +80,7 @@ protected void populateDependencyManagement( /** * {@inheritDoc} */ + @Override public String getOutputName() { return "dependency-updates-report"; } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ParentUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ParentUpdatesReport.java similarity index 92% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ParentUpdatesReportMojo.java rename to versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ParentUpdatesReport.java index 3e33ff4460..a09d897474 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ParentUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ParentUpdatesReport.java @@ -21,16 +21,13 @@ import javax.inject.Inject; -import java.util.List; import java.util.Locale; import java.util.Map; import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; -import org.apache.maven.project.MavenProject; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.api.ArtifactVersions; @@ -48,12 +45,10 @@ * @since 2.13.0 */ @Mojo(name = "parent-updates-report", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true) -public class ParentUpdatesReportMojo extends AbstractVersionsReport { - @Parameter(defaultValue = "${reactorProjects}", required = true, readonly = true) - protected List reactorProjects; +public class ParentUpdatesReport extends AbstractVersionsReport { @Inject - protected ParentUpdatesReportMojo( + protected ParentUpdatesReport( I18N i18n, ArtifactHandlerManager artifactHandlerManager, RepositorySystem repositorySystem, @@ -65,6 +60,7 @@ protected ParentUpdatesReportMojo( /** * {@inheritDoc} */ + @Override public boolean isExternalReport() { return false; } @@ -72,6 +68,7 @@ public boolean isExternalReport() { /** * {@inheritDoc} */ + @Override public boolean canGenerateReport() { if (getProject().getParent() == null) { getLog().warn("Project does not have a parent."); @@ -93,6 +90,7 @@ public boolean canGenerateReport() { * @param sink the report formatting tool */ @SuppressWarnings("deprecation") + @Override protected void doGenerateReport(Locale locale, Sink sink) throws MavenReportException { try { ArtifactVersions artifactVersions = getHelper().lookupArtifactVersions(project.getParentArtifact(), false); @@ -129,6 +127,7 @@ protected void doGenerateReport(Locale locale, Sink sink) throws MavenReportExce /** * {@inheritDoc} */ + @Override public String getOutputName() { return "parent-updates-report"; } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesAggregateReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesAggregateReport.java similarity index 95% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesAggregateReportMojo.java rename to versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesAggregateReport.java index 7f814dc504..745c20eab4 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesAggregateReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesAggregateReport.java @@ -43,10 +43,10 @@ requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true, aggregator = true) -public class PluginUpdatesAggregateReportMojo extends AbstractPluginUpdatesReportMojo { +public class PluginUpdatesAggregateReport extends AbstractPluginUpdatesReport { @Inject - protected PluginUpdatesAggregateReportMojo( + protected PluginUpdatesAggregateReport( I18N i18n, ArtifactHandlerManager artifactHandlerManager, RepositorySystem repositorySystem, @@ -80,6 +80,7 @@ protected void populatePlugins(Set pluginsCollector) { /** * {@inheritDoc} */ + @Override public String getOutputName() { return "plugin-updates-aggregate-report"; } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReport.java similarity index 95% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReportMojo.java rename to versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReport.java index 87fbfc7d82..dd0c69f38a 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReport.java @@ -40,10 +40,10 @@ * @since 1.0-beta-1 */ @Mojo(name = "plugin-updates-report", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true) -public class PluginUpdatesReportMojo extends AbstractPluginUpdatesReportMojo { +public class PluginUpdatesReport extends AbstractPluginUpdatesReport { @Inject - protected PluginUpdatesReportMojo( + protected PluginUpdatesReport( I18N i18n, ArtifactHandlerManager artifactHandlerManager, RepositorySystem repositorySystem, @@ -76,6 +76,7 @@ protected void populatePlugins(Set pluginsCollector) { /** * {@inheritDoc} */ + @Override public String getOutputName() { return "plugin-updates-report"; } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesAggregateReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesAggregateReport.java similarity index 95% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesAggregateReportMojo.java rename to versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesAggregateReport.java index 61e96b4e64..4d48274411 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesAggregateReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesAggregateReport.java @@ -47,10 +47,10 @@ requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true, aggregator = true) -public class PropertyUpdatesAggregateReportMojo extends AbstractPropertyUpdatesReportMojo { +public class PropertyUpdatesAggregateReport extends AbstractPropertyUpdatesReport { @Inject - protected PropertyUpdatesAggregateReportMojo( + protected PropertyUpdatesAggregateReport( I18N i18n, ArtifactHandlerManager artifactHandlerManager, RepositorySystem repositorySystem, @@ -88,6 +88,7 @@ protected boolean haveBuildProperties() { /** * {@inheritDoc} */ + @Override public String getOutputName() { return "property-updates-aggregate-report"; } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReport.java similarity index 95% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojo.java rename to versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReport.java index 6d55e1367a..139963a712 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReport.java @@ -43,9 +43,9 @@ * @since 1.0-beta-1 */ @Mojo(name = "property-updates-report", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true) -public class PropertyUpdatesReportMojo extends AbstractPropertyUpdatesReportMojo { +public class PropertyUpdatesReport extends AbstractPropertyUpdatesReport { @Inject - protected PropertyUpdatesReportMojo( + protected PropertyUpdatesReport( I18N i18n, ArtifactHandlerManager artifactHandlerManager, RepositorySystem repositorySystem, @@ -66,6 +66,7 @@ protected void populateUpdateSet(Map propertyCollect /** * {@inheritDoc} */ + @Override public String getOutputName() { return "property-updates-report"; } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/AbstractVersionsReportRenderer.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/AbstractVersionsReportRenderer.java index 1b9d99ce8e..9f2c9ae94c 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/AbstractVersionsReportRenderer.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/AbstractVersionsReportRenderer.java @@ -79,45 +79,33 @@ protected AbstractVersionsReportRenderer( * {@inheritDoc} */ 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")); renderOverview(); renderManagementSummaryTable(); renderSummaryTable(); - sink.section1_(); + endSection(); - sink.section1(); - sink.sectionTitle1(); - sink.text(getText("report.detail.title")); - sink.sectionTitle1_(); - sink.paragraph(); - sink.text(getText("report.detail.text")); - sink.paragraph_(); + startSection(getText("report.detail.title")); + paragraph(getText("report.detail.text")); renderDetails(); - sink.section1_(); + endSection(); } /** * Renders the "Overview" table */ protected void renderOverview() { - sink.table(); - sink.tableRows(null, false); + startTable(); sink.tableRow(); renderOverviewTableRow(computeOverviewStats()); sink.tableRow_(); - sink.tableRows_(); - sink.table_(); + endTable(); } /** @@ -188,8 +176,7 @@ protected void renderIcon(boolean success) { protected abstract void renderDetails(); protected void renderSummaryTable(Map contents, boolean hasScope) { - sink.table(); - sink.tableRows(null, false); + startTable(); sink.tableRow(); renderSummaryTableHeader(hasScope, true); @@ -201,8 +188,7 @@ protected void renderSummaryTable(Map contents, bo renderSummaryTableHeader(hasScope, true); sink.tableRow_(); - sink.tableRows_(); - sink.table_(); + endTable(); } protected void renderSummaryTableHeader(boolean hasScope, boolean hasType) { @@ -253,8 +239,7 @@ protected void renderDependencyDetailTable(Dependency artifact, ArtifactVersions ArtifactVersion[] allUpdates = allUpdatesCache.get(details, empty(), isAllowSnapshots()); boolean upToDate = allUpdates == null || allUpdates.length == 0; - sink.table(); - sink.tableRows(new int[] {Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_LEFT}, false); + startTable(new int[] {Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_LEFT}, false); renderTwoCellsRow("report.status", () -> renderStatus(details)); renderTwoCellsRow("report.groupId", artifact.getGroupId()); @@ -269,8 +254,7 @@ protected void renderDependencyDetailTable(Dependency artifact, ArtifactVersions renderTwoCellsRow("report.updateVersions", () -> renderVersions(allUpdates, details)); } - sink.tableRows_(); - sink.table_(); + endTable(); } /** @@ -347,7 +331,7 @@ private List getArtifactVersionRange(AbstractVersionDetails details } catch (InvalidVersionSpecificationException ignored) { ignored.printStackTrace(System.err); } - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/DependencyUpdatesReportRenderer.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/DependencyUpdatesReportRenderer.java index 7233e3371c..983247002a 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/DependencyUpdatesReportRenderer.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/DependencyUpdatesReportRenderer.java @@ -62,19 +62,14 @@ protected void renderManagementSummaryTable() { } protected void renderTable(String titleKey, Map contents, String emptyKey) { - sink.section2(); - sink.sectionTitle2(); - sink.text(getText(titleKey)); - sink.sectionTitle2_(); + startSection(getText(titleKey)); if (contents.isEmpty()) { - sink.paragraph(); - sink.text(getText(emptyKey)); - sink.paragraph_(); + paragraph(getText(emptyKey)); } else { renderSummaryTable(contents, true); } - sink.section2_(); + endSection(); } @Override @@ -83,11 +78,8 @@ protected OverviewStats computeOverviewStats() { } protected void renderDependencyDetail(Dependency artifact, ArtifactVersions details) { - sink.section2(); - sink.sectionTitle2(); - sink.text(ArtifactUtils.versionlessKey(artifact.getGroupId(), artifact.getArtifactId())); - sink.sectionTitle2_(); + startSection(ArtifactUtils.versionlessKey(artifact.getGroupId(), artifact.getArtifactId())); renderDependencyDetailTable(artifact, details, true); - sink.section2_(); + endSection(); } } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java index 43a2d059fe..16beebc60d 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java @@ -65,35 +65,26 @@ protected void renderDetails() { } private void renderDependencyDetail(Dependency dependency, ArtifactVersions details) { - sink.section3(); - sink.sectionTitle3(); - sink.text(MessageFormat.format( + startSection(MessageFormat.format( getText("report.pluginDependency"), ArtifactUtils.versionlessKey(dependency.getGroupId(), dependency.getArtifactId()))); - sink.sectionTitle3_(); renderDependencyDetailTable(dependency, details, false); - sink.section3_(); + endSection(); } private void renderTable(String titleKey, Map contents, String emptyKey) { - sink.section2(); - sink.sectionTitle2(); - sink.text(getText(titleKey)); - sink.sectionTitle2_(); + startSection(getText(titleKey)); if (contents.isEmpty()) { - sink.paragraph(); - sink.text(getText(emptyKey)); - sink.paragraph_(); + paragraph(getText(emptyKey)); } else { renderSummaryTable(contents); } - sink.section2_(); + endSection(); } protected void renderSummaryTable(Map contents) { - sink.table(); - sink.tableRows(null, false); + startTable(); sink.tableRow(); renderSummaryTableHeader(false, false); @@ -105,8 +96,7 @@ protected void renderSummaryTable(Map contents renderSummaryTableHeader(false, false); sink.tableRow_(); - sink.tableRows_(); - sink.table_(); + endTable(); } /** @@ -153,29 +143,21 @@ protected void renderSummaryTableRow(Dependency artifact, PluginUpdatesDetails d } private void renderPluginDetail(Dependency artifact, PluginUpdatesDetails details) { - sink.section2(); - sink.sectionTitle2(); - sink.text(MessageFormat.format( + startSection(MessageFormat.format( getText("report.plugin"), ArtifactUtils.versionlessKey(details.getGroupId(), details.getArtifactId()))); - sink.sectionTitle2_(); - renderPluginDetailTable(details); if (!details.getDependencyVersions().isEmpty()) { - sink.section3(); - sink.sectionTitle3(); - sink.text(MessageFormat.format( + startSection(MessageFormat.format( getText("report.pluginDependencies"), ArtifactUtils.versionlessKey(details.getGroupId(), details.getArtifactId()))); - sink.sectionTitle3_(); renderSummaryTable(details.getDependencyVersions(), false); - - sink.section3_(); + endSection(); details.getDependencyVersions().forEach(this::renderDependencyDetail); } - sink.section2_(); + endSection(); } private void renderPluginDetailTable(PluginUpdatesDetails details) { @@ -183,8 +165,7 @@ private void renderPluginDetailTable(PluginUpdatesDetails details) { ArtifactVersion[] allUpdates = details.getAllUpdates(empty(), isAllowSnapshots()); boolean upToDate = allUpdates == null || allUpdates.length == 0; - sink.table(); - sink.tableRows(new int[] {Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_LEFT}, false); + startTable(new int[] {Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_LEFT}, false); renderTwoCellsRow("report.status", () -> renderStatus(details)); renderTwoCellsRow("report.groupId", details.getGroupId()); @@ -194,7 +175,6 @@ private void renderPluginDetailTable(PluginUpdatesDetails details) { renderTwoCellsRow("report.updateVersions", () -> renderVersions(allUpdates, details)); } - sink.tableRows_(); - sink.table_(); + endTable(); } } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PropertyUpdatesReportRenderer.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PropertyUpdatesReportRenderer.java index 5c7269f5ef..273790a940 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PropertyUpdatesReportRenderer.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PropertyUpdatesReportRenderer.java @@ -52,7 +52,7 @@ protected void renderManagementSummaryTable() {} @Override protected void renderSummaryTable() { - renderTable("report.overview.property", model.getAllUpdates(), "report.overview.noProperty"); + renderTable(model.getAllUpdates()); } /** @@ -63,25 +63,19 @@ protected void renderDetails() { model.getAllUpdates().forEach(this::renderPropertyDetail); } - protected void renderTable(String titleKey, Map contents, String emptyKey) { - sink.section2(); - sink.sectionTitle2(); - sink.text(getText(titleKey)); - sink.sectionTitle2_(); + protected void renderTable(Map contents) { + startSection(getText("report.overview.property")); if (contents.isEmpty()) { - sink.paragraph(); - sink.text(getText(emptyKey)); - sink.paragraph_(); + paragraph(getText("report.overview.noProperty")); } else { renderSummaryTable(contents); } - sink.section2_(); + endSection(); } protected void renderSummaryTable(Map contents) { - sink.table(); - sink.tableRows(null, false); + startTable(); sink.tableRow(); renderSummaryTableHeader(false, false); @@ -93,8 +87,7 @@ protected void renderSummaryTable(Map contents) { renderSummaryTableHeader(false, false); sink.tableRow_(); - sink.tableRows_(); - sink.table_(); + endTable(); } private void renderPropertySummaryTableRow(Property property, PropertyVersions details) { @@ -117,8 +110,7 @@ protected void renderPropertyDetailTable(Property property, PropertyVersions det ArtifactVersion[] allUpdates = allUpdatesCache.get(details, empty(), isAllowSnapshots()); boolean upToDate = allUpdates == null || allUpdates.length == 0; - sink.table(); - sink.tableRows(new int[] {Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_LEFT}, false); + startTable(new int[] {Sink.JUSTIFY_RIGHT, Sink.JUSTIFY_LEFT}, false); renderTwoCellsRow("report.status", () -> renderStatus(details)); renderTwoCellsRow("report.property", "${" + property.getName() + "}"); @@ -133,8 +125,7 @@ protected void renderPropertyDetailTable(Property property, PropertyVersions det renderTwoCellsRow("report.searchReactor", property.isSearchReactor()); renderTwoCellsRow("report.preferReactor", property.isPreferReactor()); - sink.tableRows_(); - sink.table_(); + endTable(); } /** @@ -174,11 +165,8 @@ protected OverviewStats computeOverviewStats() { } private void renderPropertyDetail(Property property, PropertyVersions details) { - sink.section2(); - sink.sectionTitle2(); - sink.text("${" + property.getName() + "}"); - sink.sectionTitle2_(); + startSection("${" + property.getName() + "}"); renderPropertyDetailTable(property, details); - sink.section2_(); + endSection(); } } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/VersionsReportRendererBase.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/VersionsReportRendererBase.java index 10fa592e79..b46f2ce204 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/VersionsReportRendererBase.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/VersionsReportRendererBase.java @@ -55,7 +55,8 @@ public abstract class VersionsReportRendererBase extends AbstractMavenReportRend */ protected String bundleName; - public VersionsReportRendererBase(Sink sink, I18N i18n, Locale locale, String bundleName, boolean allowSnapshots) { + protected VersionsReportRendererBase( + Sink sink, I18N i18n, Locale locale, String bundleName, boolean allowSnapshots) { super(sink); this.i18n = i18n; this.locale = locale; @@ -102,11 +103,7 @@ protected boolean equals(ArtifactVersion v1, ArtifactVersion v2) { * headers from */ protected void renderTableHeaderCells(String... keys) { - Arrays.stream(keys).map(this::getText).forEachOrdered(str -> { - sink.tableHeaderCell(); - sink.text(str); - sink.tableHeaderCell_(); - }); + Arrays.stream(keys).map(this::getText).forEachOrdered(this::tableHeaderCell); } /** diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/DependencyUpdatesReportMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/DependencyUpdatesReportTest.java similarity index 89% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/DependencyUpdatesReportMojoTest.java rename to versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/DependencyUpdatesReportTest.java index c4da46e7b6..e85d9946c3 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/DependencyUpdatesReportMojoTest.java +++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/DependencyUpdatesReportTest.java @@ -57,15 +57,15 @@ import static org.hamcrest.Matchers.matchesPattern; /** - * Basic tests for {@linkplain DependencyUpdatesReportMojo}. + * Basic tests for {@linkplain DependencyUpdatesReport}. * * @author Andrzej Jarmoniuk */ -public class DependencyUpdatesReportMojoTest { - private static class TestDependencyUpdatesReportMojo extends DependencyUpdatesReportMojo { +public class DependencyUpdatesReportTest { + private static class TestDependencyUpdatesReport extends DependencyUpdatesReport { private static final I18N MOCK_I18N = mockI18N(); - TestDependencyUpdatesReportMojo() { + TestDependencyUpdatesReport() { super( MOCK_I18N, mockArtifactHandlerManager(), @@ -82,17 +82,17 @@ private static class TestDependencyUpdatesReportMojo extends DependencyUpdatesRe session = mockMavenSession(); } - public TestDependencyUpdatesReportMojo withDependencies(Dependency... dependencies) { + public TestDependencyUpdatesReport withDependencies(Dependency... dependencies) { project.setDependencies(Arrays.asList(dependencies)); return this; } - public TestDependencyUpdatesReportMojo withAetherRepositorySystem(RepositorySystem repositorySystem) { + public TestDependencyUpdatesReport withAetherRepositorySystem(RepositorySystem repositorySystem) { this.repositorySystem = repositorySystem; return this; } - public TestDependencyUpdatesReportMojo withOriginalDependencyManagement( + public TestDependencyUpdatesReport withOriginalDependencyManagement( Dependency... originalDependencyManagement) { project.getOriginalModel() .getDependencyManagement() @@ -100,48 +100,48 @@ public TestDependencyUpdatesReportMojo withOriginalDependencyManagement( return this; } - public TestDependencyUpdatesReportMojo withDependencyManagement(Dependency... dependencyManagement) { + public TestDependencyUpdatesReport withDependencyManagement(Dependency... dependencyManagement) { project.getModel().getDependencyManagement().setDependencies(Arrays.asList(dependencyManagement)); return this; } - public TestDependencyUpdatesReportMojo withOnlyUpgradable(boolean onlyUpgradable) { + public TestDependencyUpdatesReport withOnlyUpgradable(boolean onlyUpgradable) { this.onlyUpgradable = onlyUpgradable; return this; } - public TestDependencyUpdatesReportMojo withProcessDependencyManagement(boolean processDependencyManagement) { + public TestDependencyUpdatesReport withProcessDependencyManagement(boolean processDependencyManagement) { this.processDependencyManagement = processDependencyManagement; return this; } - public TestDependencyUpdatesReportMojo withProcessDependencyManagementTransitive( + public TestDependencyUpdatesReport withProcessDependencyManagementTransitive( boolean processDependencyManagementTransitive) { this.processDependencyManagementTransitive = processDependencyManagementTransitive; return this; } - public TestDependencyUpdatesReportMojo withOnlyProjectDependencies(boolean onlyProjectDependencies) { + public TestDependencyUpdatesReport withOnlyProjectDependencies(boolean onlyProjectDependencies) { this.onlyProjectDependencies = onlyProjectDependencies; return this; } - public TestDependencyUpdatesReportMojo withRuleSet(RuleSet ruleSet) { + public TestDependencyUpdatesReport withRuleSet(RuleSet ruleSet) { this.ruleSet = ruleSet; return this; } - public TestDependencyUpdatesReportMojo withIgnoredVersions(Set ignoredVersions) { + public TestDependencyUpdatesReport withIgnoredVersions(Set ignoredVersions) { this.ignoredVersions = ignoredVersions; return this; } - public TestDependencyUpdatesReportMojo withAllowSnapshots(boolean allowSnapshots) { + public TestDependencyUpdatesReport withAllowSnapshots(boolean allowSnapshots) { this.allowSnapshots = allowSnapshots; return this; } - public TestDependencyUpdatesReportMojo withOriginalProperty(String name, String value) { + public TestDependencyUpdatesReport withOriginalProperty(String name, String value) { project.getOriginalModel().getProperties().put(name, value); return this; } @@ -166,7 +166,7 @@ private static Dependency dependencyOf(String artifactId, String version) { public void testOnlyUpgradableDependencies() throws IOException, MavenReportException, IllegalAccessException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestDependencyUpdatesReportMojo() + new TestDependencyUpdatesReport() .withOnlyUpgradable(true) .withAetherRepositorySystem(mockAetherRepositorySystem(new HashMap() { { @@ -192,7 +192,7 @@ public void testOnlyUpgradableWithOriginalDependencyManagement() throws IOException, MavenReportException, IllegalAccessException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestDependencyUpdatesReportMojo() + new TestDependencyUpdatesReport() .withOriginalDependencyManagement( dependencyOf("artifactA"), dependencyOf("artifactB"), dependencyOf("artifactC")) .withProcessDependencyManagement(true) @@ -209,7 +209,7 @@ public void testOnlyUpgradableWithTransitiveDependencyManagement() throws IOException, MavenReportException, IllegalAccessException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestDependencyUpdatesReportMojo() + new TestDependencyUpdatesReport() .withDependencyManagement( dependencyOf("artifactA"), dependencyOf("artifactB"), dependencyOf("artifactC")) .withProcessDependencyManagement(true) @@ -226,7 +226,7 @@ public void testOnlyUpgradableWithTransitiveDependencyManagement() public void testOnlyProjectDependencies() throws IOException, MavenReportException, IllegalAccessException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestDependencyUpdatesReportMojo() + new TestDependencyUpdatesReport() .withDependencies(dependencyOf("artifactA")) .withDependencyManagement( dependencyOf("artifactA"), dependencyOf("artifactB"), dependencyOf("artifactC")) @@ -244,7 +244,7 @@ public void testOnlyProjectDependenciesWithIgnoredVersions() throws IOException, MavenReportException, IllegalAccessException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestDependencyUpdatesReportMojo() + new TestDependencyUpdatesReport() .withDependencies(dependencyOf("artifactA")) .withDependencyManagement( dependencyOf("artifactA"), dependencyOf("artifactB"), dependencyOf("artifactC")) @@ -264,7 +264,7 @@ public void testOnlyProjectDependenciesWithIgnoredVersions() public void testDependenciesInAlphabeticalOrder() throws IOException, MavenReportException, IllegalAccessException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestDependencyUpdatesReportMojo() + new TestDependencyUpdatesReport() .withAetherRepositorySystem(mockAetherRepositorySystem(new HashMap() { { put("amstrad", new String[] {"1.0.0", "2.0.0"}); @@ -292,7 +292,7 @@ public void testDependenciesShouldOverrideDependencyManagement() throws IOException, MavenReportException, IllegalAccessException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestDependencyUpdatesReportMojo() + new TestDependencyUpdatesReport() .withProcessDependencyManagement(true) .withProcessDependencyManagementTransitive(true) .withDependencies(dependencyOf("artifactA", "2.0.0"), dependencyOf("artifactB")) @@ -307,7 +307,7 @@ public void testDependenciesShouldOverrideDependencyManagement() public void testWrongReportBounds() throws IOException, MavenReportException, IllegalAccessException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestDependencyUpdatesReportMojo() + new TestDependencyUpdatesReport() .withOnlyUpgradable(true) .withDependencies(dependencyOf("test-artifact")) .withAetherRepositorySystem(mockAetherRepositorySystem(new HashMap() { @@ -329,7 +329,7 @@ public void testWrongReportBounds() throws IOException, MavenReportException, Il public void testIt001Overview() throws IOException, MavenReportException, IllegalAccessException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestDependencyUpdatesReportMojo() + new TestDependencyUpdatesReport() .withOnlyUpgradable(true) .withDependencies(dependencyOf("test-artifact", "1.1")) .withAetherRepositorySystem(mockAetherRepositorySystem(new HashMap() { @@ -357,7 +357,7 @@ public void testResolvedVersionsWithoutTransitiveDependencyManagement() throws IOException, MavenReportException, IllegalAccessException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestDependencyUpdatesReportMojo() + new TestDependencyUpdatesReport() .withOriginalDependencyManagement( dependencyOf("artifactA", "1.0.0"), dependencyOf("artifactB", "${mycomponent.version}")) .withDependencyManagement( @@ -376,7 +376,7 @@ public void testResolvedVersionsWithoutTransitiveDependencyManagement() public void testVersionlessDependency() throws IOException, MavenReportException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestDependencyUpdatesReportMojo() + new TestDependencyUpdatesReport() .withOriginalDependencyManagement(dependencyOf("artifactA", null)) .withProcessDependencyManagement(true) .withProcessDependencyManagementTransitive(false) diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ParentUpdatesReportMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ParentUpdatesReportTest.java similarity index 96% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ParentUpdatesReportMojoTest.java rename to versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ParentUpdatesReportTest.java index 579aa1d0d5..d06454d3d2 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ParentUpdatesReportMojoTest.java +++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ParentUpdatesReportTest.java @@ -47,18 +47,18 @@ import static org.hamcrest.Matchers.allOf; /** - * Basic tests for {@linkplain ParentUpdatesReportMojo}. + * Basic tests for {@linkplain ParentUpdatesReport}. * * @author Andrzej Jarmoniuk */ -public class ParentUpdatesReportMojoTest { +public class ParentUpdatesReportTest { private static final I18N MOCK_I18N = mockI18N(); @Test public void testAllowSnapshots() throws IOException, MavenReportException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new ParentUpdatesReportMojo( + new ParentUpdatesReport( MOCK_I18N, mockArtifactHandlerManager(), mockAetherRepositorySystem(new HashMap() { diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PluginUpdatesReportMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PluginUpdatesReportTest.java similarity index 88% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PluginUpdatesReportMojoTest.java rename to versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PluginUpdatesReportTest.java index 3040378dda..e5597238b6 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PluginUpdatesReportMojoTest.java +++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PluginUpdatesReportTest.java @@ -53,15 +53,15 @@ import static org.hamcrest.Matchers.matchesPattern; /** - * Basic tests for {@linkplain PluginUpdatesReportMojo}. + * Basic tests for {@linkplain PluginUpdatesReport}. * * @author Andrzej Jarmoniuk */ -public class PluginUpdatesReportMojoTest { - private static class TestPluginUpdatesReportMojo extends PluginUpdatesReportMojo { +public class PluginUpdatesReportTest { + private static class TestPluginUpdatesReport extends PluginUpdatesReport { static final I18N MOCK_I18N = mockI18N(); - TestPluginUpdatesReportMojo() { + TestPluginUpdatesReport() { super( MOCK_I18N, mockArtifactHandlerManager(), @@ -77,37 +77,37 @@ private static class TestPluginUpdatesReportMojo extends PluginUpdatesReportMojo session = mockMavenSession(); } - public TestPluginUpdatesReportMojo withPlugins(Plugin... plugins) { + public TestPluginUpdatesReport withPlugins(Plugin... plugins) { project.getBuild().setPlugins(Arrays.asList(plugins)); return this; } - public TestPluginUpdatesReportMojo withAetherRepositorySystem(RepositorySystem repositorySystem) { + public TestPluginUpdatesReport withAetherRepositorySystem(RepositorySystem repositorySystem) { this.repositorySystem = repositorySystem; return this; } - public TestPluginUpdatesReportMojo withPluginManagement(Plugin... pluginManagement) { + public TestPluginUpdatesReport withPluginManagement(Plugin... pluginManagement) { project.getBuild().getPluginManagement().setPlugins(Arrays.asList(pluginManagement)); return this; } - public TestPluginUpdatesReportMojo withOnlyUpgradable(boolean onlyUpgradable) { + public TestPluginUpdatesReport withOnlyUpgradable(boolean onlyUpgradable) { this.onlyUpgradable = onlyUpgradable; return this; } - public TestPluginUpdatesReportMojo withOnlyProjectPlugins(boolean onlyProjectPlugins) { + public TestPluginUpdatesReport withOnlyProjectPlugins(boolean onlyProjectPlugins) { this.onlyProjectPlugins = onlyProjectPlugins; return this; } - public TestPluginUpdatesReportMojo withRuleSet(RuleSet ruleSet) { + public TestPluginUpdatesReport withRuleSet(RuleSet ruleSet) { this.ruleSet = ruleSet; return this; } - public TestPluginUpdatesReportMojo withIgnoredVersions(Set ignoredVersions) { + public TestPluginUpdatesReport withIgnoredVersions(Set ignoredVersions) { this.ignoredVersions = ignoredVersions; return this; } @@ -131,7 +131,7 @@ private static Plugin pluginOf(String artifactId, String version) { public void testOnlyUpgradablePlugins() throws IOException, MavenReportException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestPluginUpdatesReportMojo() + new TestPluginUpdatesReport() .withAetherRepositorySystem(mockAetherRepositorySystem(new HashMap() { { put("artifactA", new String[] {"1.0.0", "2.0.0"}); @@ -154,7 +154,7 @@ public void testOnlyUpgradablePlugins() throws IOException, MavenReportException public void testOnlyUpgradableWithPluginManagement() throws IOException, MavenReportException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestPluginUpdatesReportMojo() + new TestPluginUpdatesReport() .withAetherRepositorySystem(mockAetherRepositorySystem(new HashMap() { { put("artifactA", new String[] {"1.0.0", "2.0.0"}); @@ -177,7 +177,7 @@ public void testOnlyUpgradableWithPluginManagement() throws IOException, MavenRe public void testOnlyProjectPlugins() throws IOException, MavenReportException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestPluginUpdatesReportMojo() + new TestPluginUpdatesReport() .withPlugins(pluginOf("artifactA")) .withPluginManagement(pluginOf("artifactA"), pluginOf("artifactB"), pluginOf("artifactC")) .withOnlyUpgradable(true) @@ -193,7 +193,7 @@ public void testOnlyProjectPlugins() throws IOException, MavenReportException { public void testOnlyProjectPluginsWithIgnoredVersions() throws IOException, MavenReportException { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - new TestPluginUpdatesReportMojo() + new TestPluginUpdatesReport() .withPlugins(pluginOf("artifactA")) .withPluginManagement(pluginOf("artifactA"), pluginOf("artifactB"), pluginOf("artifactC")) .withOnlyUpgradable(true) diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PropertyUpdatesReportTest.java similarity index 91% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojoTest.java rename to versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PropertyUpdatesReportTest.java index a0769942a0..b41eb443a4 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojoTest.java +++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PropertyUpdatesReportTest.java @@ -39,9 +39,9 @@ import static org.hamcrest.Matchers.not; /** - * Unit tests for {@link PropertyUpdatesReportMojo} + * Unit tests for {@link PropertyUpdatesReport} */ -public class PropertyUpdatesReportMojoTest extends AbstractMojoTestCase { +public class PropertyUpdatesReportTest extends AbstractMojoTestCase { @Rule public MojoRule mojoRule = new MojoRule(this); @@ -53,7 +53,7 @@ public void testIncludeParentTrueShouldContainProperty() throws Exception { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - PropertyUpdatesReportMojo mojo = (PropertyUpdatesReportMojo) mojoRule.lookupConfiguredMojo( + PropertyUpdatesReport mojo = (PropertyUpdatesReport) mojoRule.lookupConfiguredMojo( new File("src/test/resources/org/codehaus/mojo/display-property-updates/issue-367/child"), "property-updates-report"); setVariableValueToObject(mojo, "siteTool", SITE_TOOL); @@ -73,7 +73,7 @@ public void testIncludeParentFalseShouldNotContainProperty() throws Exception { OutputStream os = new ByteArrayOutputStream(); SinkFactory sinkFactory = new Xhtml5SinkFactory(); - PropertyUpdatesReportMojo mojo = (PropertyUpdatesReportMojo) mojoRule.lookupConfiguredMojo( + PropertyUpdatesReport mojo = (PropertyUpdatesReport) mojoRule.lookupConfiguredMojo( new File("src/test/resources/org/codehaus/mojo/display-property-updates/issue-367/child"), "property-updates-report"); setVariableValueToObject(mojo, "siteTool", SITE_TOOL); diff --git a/versions-test/pom.xml b/versions-test/pom.xml index 41906af21b..1068fc6958 100644 --- a/versions-test/pom.xml +++ b/versions-test/pom.xml @@ -56,10 +56,6 @@ org.apache.maven.doxia doxia-integration-tools
- - org.apache.maven.doxia - doxia-decoration-model - org.apache.commons commons-text