Skip to content

Remove the API deprecated since Maven 3 (tracking issue) #14157

Backlog

Description

@slachiewicz

Tracking issue for removing the classes and methods that were already deprecated in Maven 3 and are still shipped on master. It is one block of #7952 (remove old deprecated code); #8177 tracks the maven-compat module as a whole and #13460 tracks the internal move to the v4 API.

The question behind it: which of these can go in a 4.x minor, and which have to wait for the plugins that still call them.

Measured on 2026-11-27 against maven-3.9.x df0ec4930 and master f6c51799d. The usage scan covers the default branches of 131 active repositories: apache/maven-* (without this one), codehaus-plexus and mojohaus.

What is deprecated

maven-3.9.x carries 227 @Deprecated elements in main code: 76 types and 151 members.

Module (3.9.x) Deprecated types Deprecated members
maven-compat 41 33
maven-core 21 99
maven-artifact 4 5
maven-model-builder 4 2
maven-settings-builder 4 3
maven-resolver-provider 1 7
maven-settings 1 0
maven-embedder, maven-plugin-api 0 1 each

Of the 76 types, 73 are still on master under the same name and still deprecated: 66 under compat/ (53 of them in compat/maven-compat) and 7 in impl/maven-core. Three are gone: MavenProfilesBuilder, DefaultMavenProfilesBuilder and MavenResolverModule.

MavenProject (32 members) and MavenSession (16 members) hold a third of the deprecated members.

Who still uses the types

Ten of the 76 types are still imported somewhere in the 131 repositories; 66 have no importer.

Deprecated type Main-code files Repositories (main code)
artifact.repository.ArtifactRepository 17 maven-archetype, maven-dependency-plugin, maven-dependency-tree, maven-enforcer, maven-plugin-testing, maven-plugin-tools, maven-project-info-reports-plugin, maven-site-plugin, mojohaus/license-maven-plugin
artifact.metadata.ArtifactMetadata 3 maven-plugin-testing, maven-site-plugin
artifact.factory.ArtifactFactory 3 maven-enforcer, maven-plugin-testing, mojohaus/maven-native
model.building.ModelSource 2 maven-resolver-ant-tasks, mojohaus/flatten-maven-plugin
artifact.repository.ArtifactRepositoryPolicy 1 maven-plugin-testing
artifact.repository.layout.ArtifactRepositoryLayout 1 maven-plugin-testing
artifact.metadata.AbstractArtifactMetadata 1 maven-site-plugin
plugin.PluginManager 1 maven-enforcer
toolchain.java.DefaultJavaToolChain 1 maven-surefire
artifact.metadata.ArtifactMetadataSource 0 tests only, in maven-plugin-tools

Test code adds ten more repositories, mostly for ArtifactRepository and ArtifactRepositoryPolicy in mocks and stubs.

The 66 types with no importer
  • maven-compat (41): everything deprecated in artifact.manager, artifact.resolver, profiles, profiles.activation, project, project.inheritance, project.interpolation, project.path, project.validation, execution, plus DefaultArtifactRepository, ManagedVersionMap, LegacyArtifactCollector and DefaultConflictResolver.
  • maven-core (16): ProjectDependenciesResolver, DefaultProjectDependenciesResolver, ArtifactMetadataRetrievalException, ResolutionGroup, RepositoryCache, ReactorManager, EventDispatcher, EventMonitor, DebugConfigurationListener, ActiveProjectArtifact, AttachedArtifact, PathTranslator, DelegatingLocalArtifactRepository, the legacy repository.RepositorySystem, MavenSettingsBuilder, DefaultToolchainsBuilder.
  • maven-settings-builder (4): SettingsSource, FileSettingsSource, StringSettingsSource, UrlSettingsSource.
  • maven-model-builder (3): StringModelSource, UrlModelSource, StringSearchModelInterpolator.
  • maven-settings (1): RuntimeInfo.
  • maven-resolver-provider (1): MavenResolverModule, already removed on master.

Who still calls the methods

Call sites in main code, read line by line; tests add more in the same repositories.

Deprecated method Files Repositories
MavenProject.getDependencyArtifacts() 15 maven-assembly-plugin, maven-dependency-plugin, maven-enforcer, maven-javadoc-plugin, maven-mvnd, maven-release, maven-remote-resources-plugin, maven-war-plugin, mojohaus/aspectj-maven-plugin, mojohaus/license-maven-plugin, mojohaus/versions
MavenProject.getTestArtifacts() 3 maven-javadoc-plugin, maven-surefire, mojohaus/exec-maven-plugin
MavenProject.getCompileArtifacts(), getRuntimeArtifacts(), getSystemArtifacts() 1 mojohaus/exec-maven-plugin
MavenProject.getReportPlugins() 2 maven-enforcer, maven-project-info-reports-plugin
MavenProject.getReportArtifacts() 2 maven-enforcer, maven-release
MavenProject.getReportArtifactMap(), getExtensionArtifacts(), getExtensionArtifactMap() 1 each maven-release
MavenProject.getScriptSourceRoots() 1 maven-plugin-tools
MavenSession.getContainer() 1 maven-enforcer
MavenSession.getSortedProjects(), lookup*(), getExecutionProperties(), getEventDispatcher(), isUsingPOMsFromFilesystem() 0 none

MavenProjectStub in maven-plugin-testing overrides 22 of the deprecated MavenProject methods.

Per-repository issues

Out of scope: what only Maven 4 deprecated

master deprecates 492 types in total. The other 419 are the regular Maven 3 plugin API, deprecated in favor of org.apache.maven.api, and 120 of the 492 are imported by 68 of the scanned repositories: ProjectBuilder (89 main-code files in 16 repositories), MavenReportException (66 in 22), ToolchainManager (54 in 15), SettingsDecrypter (35 in 7), MavenXpp3Reader (18 in 15). Those stay for as long as Maven 4 runs Maven 3 plugins and are not part of this issue.

MultiThreadedBuilder is not part of it either: it is not deprecated on any branch, and -T still selects it on master.

Plan

  • Scan this repository for uses of the 73 remaining types and the deprecated members, in main code, tests and its/, and sort each one: no caller, called only from compat/, or called from impl/.
  • Remove on master what has no caller here and no importer in the scanned repositories (label removed).
  • maven-enforcer: move off PluginManager, ArtifactFactory and MavenSession.getContainer().
  • maven-site-plugin: move off ArtifactMetadata and AbstractArtifactMetadata.
  • maven-plugin-testing: drop the stubs for the removed methods.
  • ArtifactRepository: move the nine repositories to Resolver's RemoteRepository and LocalRepository.
  • getDependencyArtifacts(): move the 11 repositories to getArtifacts() narrowed to the direct dependencies.
  • ModelSource: move maven-resolver-ant-tasks and flatten-maven-plugin to ModelSource2.
  • Mark what still has callers forRemoval = true, and remove it once the plugin releases are out.

Limits

  • The type scan matches import lines. Same-package use, inline fully qualified names and five files with wildcard Maven imports are not counted.
  • Only default branches were scanned, not the -4.x lines of the plugins.
  • Plugins outside the three organizations are not covered; a type with no importer here can still have users elsewhere.
  • Uses inside apache/maven itself are the first item of the plan and are not measured yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tracking

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions