Repository navigation
Description
Tracking issue for removing the maven-compat module. Opened as MNG-7266 by Guillaume Nodet, part of #7952 (remove old deprecated code); #9185 made the module optional for core itself. The original PR #1487 is closed as stale, and the work below is the input for a fresh one.
Related: #9943 (restore Maven 3 compatibility), MPLUGIN-377 (drop legacy APIs in plugin-tools), #12709 (plugin baseline), #13085 (release plan).
Measured on 2026-09-19 against the stock 3.9.16 and 3.10.0-rc-1 distributions. The source scan covers master 00a35a9377 and the default and live maintenance branches of 87 apache/maven* repositories, as of 2026-10-05.
Maven 3.9 and 3.10
The runtime doesn't need the module. With lib/maven-compat-*.jar deleted from both distributions, clean deploy site passes on a reactor that uses toolchains, compiler 3.16.0, surefire 3.5.4, jar, javadoc, source, enforcer, dependency, plugin-plugin 3.15.1, install, deploy, and site 3.21.0 with the project-info reports.
Three released plugins do need it, always for the same reason: they inject a maven-core interface whose only implementation is in maven-compat, so Guice injects null (null returned by binding at LocatorWiring … is not @Nullable). The fixes are on their master branches and verified on the same compat-less distributions:
| Plugin | Released version, without the jar | master snapshot, without the jar |
Release |
|---|---|---|---|
| project-info-reports | 3.9.0: every report fails (legacy RepositorySystem) |
3.9.1-SNAPSHOT: six reports render | 3.10.0 (MPIR-477), #13085 |
| dependency-plugin | 3.11.0: dependency:get fails (legacy RepositorySystem in GetMojo) |
3.11.1-SNAPSHOT a9176af4: get, copy, tree, analyze, resolve-plugins, list-repositories pass |
3.12.0 (MDEP-858), #13085 |
| doap-plugin | 3.0.0-M1: doap:generate fails (ArtifactResolver, MavenProjectBuilder, RepositoryMetadataManager) |
3.0.0-M2-SNAPSHOT c34d476: generate writes the RDF files |
3.0.0-M2, #13085 |
A scan of the latest release tag of 81 apache/maven-* repositories found no other plugin that uses a maven-compat class or one of those interfaces in src/main. plugin-tools 3.16.0 referenced PathTranslator from maven-script-ant without ever looking it up; apache/maven-plugin-tools#1200 removed the reference. Outside plugins, apache/maven-shared-io is the only library that still uses the Maven 2 API in src/main (ArtifactResolver, WagonManager).
Two things stay as they are on 3.x. The distribution keeps bundling the jar, because third-party plugins written against the Maven 2 API still need it and Maven3CompatDependenciesValidator warns their users. The test-scoped maven-compat in plugin POMs (checkstyle, javadoc, project-info-reports, release, reporting-exec, war) is a harness question: maven-core older than 3.9.12 needs the compat RepositorySystem to boot the test container (#12709). It doesn't affect users; all six removals are merged (see the tasks).
Maven 4
Maven core itself doesn't use compat: impl/**/src/main has no reference to its classes. Three things do.
The distribution carries 64 classes that were in maven-core on 3.9.x. Plugins written for Maven 3 never declared maven-compat for them, so removing the module breaks them at runtime:
| Classes | Moved by | Plugins that use them in src/main |
|---|---|---|
org.apache.maven.toolchain.* (16 classes, bridged onto the v4 ToolchainManager by compat's ToolchainManagerFactory) |
#9888, 4.0.0-rc-3 | surefire, javadoc, pmd, jdeps, jdeprscan, jarsigner, jlink, jmod, invoker, artifact-plugin, toolchains-plugin, compiler-plugin 3.x, jar-plugin 3.x |
ArtifactRepositoryMetadata, AbstractRepositoryMetadata, AbstractArtifactMetadata, RepositoryMetadata, ProjectArtifactMetadata, RepositoryMetadataManager, PluginManager |
#9185 | maven-plugin-plugin LegacySupport, maven-site-plugin SiteDescriptorArtifactMetadata, maven-dependency-plugin ResolverUtil, enforcer RequirePluginVersions |
The compiler 3.x line is why impl/maven-cli needs compat at test scope: its invoker tests run verify on a sample project, and the compiler plugin fails with ClassNotFoundException: org.apache.maven.toolchain.ToolchainManager without it.
The core ITs. 21 IT-plugin sources under its/core-it-support use compat classes (ArtifactResolver, WagonManager, ArtifactRepositoryFactory, the v3 toolchain API, ArtifactInstaller, ArtifactDeployer, MavenProjectBuilder, RuntimeInformation), in core-it-plugins/* and core-it-toolchain, and so do the fixtures mng-3652, 4207, 5445, 6759, and gh-11314. 29 POMs declare maven-compat; 18 of them belong to modules that use no compat class and only reach MavenProject through it: the 14 maven-it-plugin-core-stubs/*, maven-it-plugin-touch, -fork, -configuration, and -project-interpolation.
Core wiring. apache-maven/pom.xml bundles the module, extension.xml exports it, Maven3CompatDependenciesValidator only warns, and DefaultLifecycles keeps a shim for compat's EmptyLifecycleExecutor.
Tasks
The 3.x releases come first because they unblock users today; the Maven 4 groups follow the dependencies between them.
Maven 3.x plugin releases
- doap-plugin 3.0.0-M2, released 2026-09-27.
- project-info-reports 3.10.0, dependency-plugin 3.12.0 (Planned releases — Q4 2026 (Doxia stack + plugins + shared deps) #13085).
- plugin-tools: drop the
PathTranslatorreference (Drop the PathTranslator requirement from Ant mojos maven-plugin-tools#1200, ships in 3.17.0). - Drop the test-scope declarations where the baseline was already 3.9.16: Drop the test-scoped maven-compat dependency maven-project-info-reports-plugin#658, Drop the test-scoped maven-compat dependency maven-release#1498, Drop the test-scoped maven-compat dependency maven-war-plugin#655.
- Move
mavenVersion3.6.3 → 3.9.16 with<prerequisites>kept at 3.6.3, and drop the declaration: Drop maven-compat by moving the Maven baseline to 3.9.16 maven-reporting-exec#163, Move the Maven baseline to 3.9.16 and drop maven-compat maven-checkstyle-plugin#705, Move the Maven baseline to 3.9.16 and drop maven-compat maven-javadoc-plugin#1382. reporting-exec also moved its javadoc-plugin test pin from 3.4.0 to 3.12.0 and replaced the compatArtifactRepositoryFactorylookup withMavenRepositorySystem.createArtifactRepository.
Maven 4: decide
- Choose the shape: stop bundling in the distribution but keep publishing ([MNG-8338] Refactor subprojects to make old ones optional #10290), or delete the module.
masteronly; 4.0.x keeps it. - Decide which Maven 2-era behaviors the core IT suite still guarantees.
Maven 4: move what Maven 3 plugins still need into maven-core
- The v3 toolchain bridge (
org.apache.maven.toolchain.*,ToolchainManagerFactory). Every dependency it uses is already a maven-core dependency and the package is already exported, so the move is mechanical; the@Priority(10)override of the v4ToolchainManagerhas to move with it. - The seven metadata and manager classes, or fix the four plugins instead: site descriptor metadata as an attached artifact, drop
LegacySupportin maven-plugin-plugin (unneeded since Resolver 1.9), filter in dependencyResolverUtilwithoutProjectArtifactMetadata, enforcer onBuildPluginManager.
Maven 4: core ITs
- Rewrite or delete the 21 IT-plugin sources in
core-it-support/core-it-plugins/*andcore-it-toolchain. - Rewrite or delete the fixtures mng-3652, 4207, 5445, 6759, Injection problem found in maven-toolchains-plugin #11314.
- Replace
maven-compatwithmaven-corein the 18 IT plugins that use no compat class; they only needMavenProject(Depend on maven-core instead of maven-compat in 18 core IT plugins #13351, 4.0.x backport Backport #13351: Depend on maven-core instead of maven-compat in 18 core IT plugins #13354). - Drop the remaining 11 once their sources are rewritten.
Maven 4: core cleanup
-
apache-maven/pom.xml: stop bundling. -
impl/maven-cli/pom.xml: drop the test-scope dependency (after the toolchain move). -
extension.xml: drop theorg.apache.maven:maven-compatexport. -
Maven3CompatDependenciesValidator: warning to error. -
DefaultLifecycles: remove theEmptyLifecycleExecutorshim. - Root POM, BOM,
compat/pom.xml: drop the module.
Not verified: whether a plugin-declared maven-compat loads in a plugin realm once core stops exporting it, and the roughly 60 other Apache projects that declare it in a plugin POM.
Activity
jira-importer commentedon Apr 15, 2024
Tamas Cservenak commented
Maven-core module never depended on maven-compat so am a bit confused
jira-importer commentedon Apr 15, 2024
Tamas Cservenak commented
But if the idea is to drop maven2 support, I am for it, although unsure we have no plugin depending on maven-compat. Plus, I kinda remember that some plugin testing does depend on it...
jira-importer commentedon Apr 15, 2024
Romain Manni-Bucau commented
Let's drop it, worse case we compensate it later if really bothering for some plugin but shouldnt now.
jira-importer commentedon Apr 15, 2024
Tamas Cservenak commented
Drop it, maven-compat provides "compat components" for maven2 plugins, and Maven3 was there to provide "transitioning". Maven4 should NOT care about maven2 plugins.
jira-importer commentedon Apr 15, 2024
Slawomir Jaranowski commented
In more of cases it is needed by tests in runtime, when used interfaces like:
also maven-plugin-testing-harness bellow version 4.0.0-alpha-2 require it in classpath.
Depend on maven-core instead of maven-compat in 18 core IT plugins
Depend on maven-core instead of maven-compat in 18 core IT plugins