From 76b4562f951df209479c1ab2ff4db7e8167b3c44 Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sat, 8 Aug 2026 16:36:49 +0200 Subject: [PATCH] Remove maven-compat, which needed three things rather than one Nothing here imports maven-compat, but removing it took more than deleting the line. First, the baseline. maven-core 3.6.3 ships DefaultProjectBuildingHelper with a field of the legacy org.apache.maven.repository.RepositorySystem, implemented only in maven-compat, so Mojo lookups fail without it. maven-core 3.9.12 moved that field to MavenRepositorySystem in maven-core -- commit 3afbdb8f76, first released in 3.9.12. So mavenVersion moves there, and resolverVersion to the 1.9.25 that ships with it. Second, the test built its local repository through ArtifactRepositoryFactory, which lives only in maven-compat. MavenRepositorySystem.createArtifactRepository is a static method with the same five parameters, so the call is unchanged apart from the receiver. Third, and least obvious: the test loads maven-javadoc-plugin to exercise the executor, and pinned 3.4.0. That version needs RepositoryMetadataManager, whose only implementation -- DefaultRepositoryMetadataManager -- is also in maven-compat, so the removal failed on a component this project never mentions. Current javadoc-plugin does not use it, so the pin moves to 3.12.0. Tests: 4, 0 failures, same as master under mvn verify. --- pom.xml | 10 ++-------- .../reporting/exec/TestDefaultMavenReportExecutor.java | 9 ++++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 0666a00..e71632b 100644 --- a/pom.xml +++ b/pom.xml @@ -57,8 +57,8 @@ 8 - 3.6.3 - 1.4.1 + 3.9.12 + 1.9.25 1.7.36 ${version.maven-site-plugin} ${version.maven-project-info-reports-plugin} @@ -187,12 +187,6 @@ ${mavenVersion} test - - org.apache.maven - maven-compat - ${mavenVersion} - test - org.apache.maven maven-resolver-provider diff --git a/src/test/java/org/apache/maven/reporting/exec/TestDefaultMavenReportExecutor.java b/src/test/java/org/apache/maven/reporting/exec/TestDefaultMavenReportExecutor.java index 878410f..6228798 100644 --- a/src/test/java/org/apache/maven/reporting/exec/TestDefaultMavenReportExecutor.java +++ b/src/test/java/org/apache/maven/reporting/exec/TestDefaultMavenReportExecutor.java @@ -30,9 +30,9 @@ import org.apache.maven.Maven; import org.apache.maven.RepositoryUtils; import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.apache.maven.bridge.MavenRepositorySystem; import org.apache.maven.cli.MavenCli; import org.apache.maven.cli.configuration.SettingsXmlConfigurationProcessor; import org.apache.maven.execution.DefaultMavenExecutionRequest; @@ -131,7 +131,7 @@ void reportingPluginWithDependenciesInPluginManagement() throws Exception { Plugin plugin = new Plugin(); plugin.setGroupId("org.apache.maven.plugins"); plugin.setArtifactId("maven-javadoc-plugin"); - plugin.setVersion("3.4.0"); + plugin.setVersion("3.12.0"); Dependency dependency = new Dependency(); dependency.setGroupId("commons-lang"); dependency.setArtifactId("commons-lang"); @@ -170,7 +170,7 @@ private List buildReports(MavenProject mavenProject, Repor ReportPlugin reportPlugin = new ReportPlugin(); reportPlugin.setGroupId("org.apache.maven.plugins"); reportPlugin.setArtifactId("maven-javadoc-plugin"); - reportPlugin.setVersion("3.4.0"); + reportPlugin.setVersion("3.12.0"); for (ReportSet reportSet : javadocReportSets) { reportPlugin.getReportSets().add(reportSet); @@ -249,7 +249,6 @@ public MavenProject getCurrentProject() { } private ArtifactRepository getLocalRepo() throws Exception { - ArtifactRepositoryFactory artifactRepositoryFactory = plexusContainer.lookup(ArtifactRepositoryFactory.class); ArtifactRepositoryLayout defaultArtifactRepositoryLayout = plexusContainer.lookup(ArtifactRepositoryLayout.class, "default"); String updatePolicyFlag = ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS; @@ -260,7 +259,7 @@ private ArtifactRepository getLocalRepo() throws Exception { new ArtifactRepositoryPolicy(true, updatePolicyFlag, checksumPolicyFlag); String localRepoPath = System.getProperty("localRepository", MavenCli.USER_MAVEN_CONFIGURATION_HOME.getPath() + "/repository"); - return artifactRepositoryFactory.createArtifactRepository( + return MavenRepositorySystem.createArtifactRepository( "local", Paths.get(localRepoPath).toUri().toASCIIString(), defaultArtifactRepositoryLayout,