Skip to content

Commit

Permalink
Upgrade to Doxia 2.x stack
Browse files Browse the repository at this point in the history
fix: #1168
  • Loading branch information
slawekjaranowski committed Nov 10, 2024
1 parent 380264f commit dac9646
Show file tree
Hide file tree
Showing 33 changed files with 265 additions and 308 deletions.
45 changes: 14 additions & 31 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<scm>
<connection>scm:git:https://github.com/mojohaus/versions.git</connection>
<developerConnection>scm:git:ssh://[email protected]/mojohaus/versions.git</developerConnection>
<tag>2.15.0</tag>
<tag>HEAD</tag>
<url>https://github.com/mojohaus/versions/tree/master</url>
</scm>

Expand All @@ -120,8 +120,12 @@

<properties>
<mavenVersion>3.6.3</mavenVersion>
<doxiaVersion>1.12.0</doxiaVersion>
<doxia-sitetoolsVersion>1.11.1</doxia-sitetoolsVersion>

<doxiaVersion>2.0.0</doxiaVersion>
<doxia-sitetoolsVersion>2.0.0</doxia-sitetoolsVersion>
<reportingApiVersion>4.0.0</reportingApiVersion>
<reportingImplVersion>4.0.0</reportingImplVersion>

<mockitoVersion>4.11.0</mockitoVersion>
<woodstoxVersion>7.1.0</woodstoxVersion>
<stax2ApiVersion>4.2.2</stax2ApiVersion>
Expand Down Expand Up @@ -228,24 +232,18 @@
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>3.1.1</version>
<version>${reportingApiVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>3.2.0</version>
<version>${reportingImplVersion}</version>
</dependency>

<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-core</artifactId>
<version>${doxiaVersion}</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
Expand All @@ -254,26 +252,21 @@
</dependency>

<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<version>${doxia-sitetoolsVersion}</version>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-i18n</artifactId>
<version>1.0-beta-10</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-integration-tools</artifactId>
<version>${doxia-sitetoolsVersion}</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -359,11 +352,6 @@
<artifactId>commons-io</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
Expand Down Expand Up @@ -392,11 +380,6 @@
<artifactId>wagon-provider-api</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-decoration-model</artifactId>
<version>1.11.1</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
2 changes: 1 addition & 1 deletion versions-enforcer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<profile>
<!-- run integration tests
to use this profile:
or run integration tests: ./mvnw -Prun-its
or run integration tests: mvn -Prun-its
-->
<id>run-its</id>
<build>
Expand Down
42 changes: 9 additions & 33 deletions versions-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,31 +88,18 @@
</dependency>

<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-common-artifact-filters</artifactId>
</dependency>

<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
</exclusion>
</exclusions>
<artifactId>maven-reporting-api</artifactId>
</dependency>

<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-common-artifact-filters</artifactId>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
</dependency>

<!-- Doxia -->
Expand All @@ -125,20 +112,9 @@
<artifactId>doxia-sink-api</artifactId>
</dependency>

<!-- Doxia-sitetools -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-i18n</artifactId>
</dependency>

<dependency>
Expand Down Expand Up @@ -326,7 +302,7 @@
<profile>
<!-- run integration tests
to use this profile:
or run integration tests: ./mvnw -Prun-its
or run integration tests: mvn -Prun-its
-->
<id>run-its</id>
<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -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+', ' ' )
Expand All @@ -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+', ' ' )
Expand Down
Original file line number Diff line number Diff line change
@@ -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+', ' ' )
Expand All @@ -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+', ' ' )
Expand Down
Original file line number Diff line number Diff line change
@@ -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+', ' ' )
Expand All @@ -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+', ' ' )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Original file line number Diff line number Diff line change
@@ -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/ )
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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+', ' ' )
Expand Down
Original file line number Diff line number Diff line change
@@ -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+', ' ' )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
/**
* Generates a report of available updates for the dependencies of a project.
*/
public abstract class AbstractDependencyUpdatesReportMojo extends AbstractVersionsReport<DependencyUpdatesModel> {
public abstract class AbstractDependencyUpdatesReport extends AbstractVersionsReport<DependencyUpdatesModel> {

private static final DependencyComparator DEPENDENCY_COMPARATOR = DependencyComparator.INSTANCE;

Expand Down Expand Up @@ -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,
Expand All @@ -115,13 +115,15 @@ public AbstractDependencyUpdatesReportMojo(
/**
* {@inheritDoc}
*/
@Override
public boolean isExternalReport() {
return false;
}

/**
* {@inheritDoc}
*/
@Override
public boolean canGenerateReport() {
return true;
}
Expand All @@ -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<Dependency> dependencies = getDependencies();
Expand Down Expand Up @@ -188,7 +190,7 @@ protected void doGenerateReport(Locale locale, Sink sink) throws MavenReportExce
}

protected void handleDependencyManagementTransitive(
MavenProject project, Set<Dependency> dependencyManagementCollector) throws MavenReportException {
MavenProject project, Set<Dependency> dependencyManagementCollector) {
if (processDependencyManagementTransitive) {
if (hasDependencyManagement(project)) {
if (getLog().isDebugEnabled()) {
Expand Down Expand Up @@ -242,7 +244,7 @@ private Set<Dependency> 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.
*
Expand All @@ -266,7 +268,7 @@ private Set<Dependency> getDependencyManagement(Set<Dependency> 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.
*
Expand All @@ -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());
Expand All @@ -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();
}
}
Expand Down Expand Up @@ -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";
}
}
Loading

0 comments on commit dac9646

Please sign in to comment.