slachiewicz opened a new issue, #14157:
URL: https://github.com/apache/maven/issues/14157

   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](https://github.com/apache/maven/commit/df0ec49309e27a9f020d467ca152bab7ce8dfa79)
 and `master` 
[f6c51799d](https://github.com/apache/maven/commit/f6c51799d93ab6733eaa56b0dc1e187d2b5cb954).
 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.
   
   <details>
   <summary>The 66 types with no importer</summary>
   
   - `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`.
   
   </details>
   
   ## Who still calls the methods
   
   This part is a name search in main-code files that import `MavenProject` or 
`MavenSession`, so it can over-count where another class has a method of the 
same name.
   
   | Deprecated method | Files | Repositories |
   |---|---|---|
   | `MavenProject.getDependencyArtifacts()` | 19 | 13, among them assembly, 
dependency, enforcer, javadoc, release, remote-resources, war, mvnd and four 
MojoHaus plugins |
   | `MavenProject.getReportPlugins()` | 6 | maven-enforcer, 
maven-plugin-testing, maven-project-info-reports-plugin, maven-reporting-exec, 
mojohaus/versions |
   | `MavenProject.getTestArtifacts()` and the other scoped getters | 4 | 
maven-javadoc-plugin, maven-plugin-testing, maven-surefire, 
mojohaus/exec-maven-plugin |
   | `MavenSession.getSortedProjects()` | 3 | maven-enforcer, 
mojohaus/buildnumber-maven-plugin |
   | `MavenSession.lookupList()`, `lookupMap()`, `getContainer()` | 1 to 2 each 
| maven-enforcer, maven-plugin-testing |
   | `MavenSession.getExecutionProperties()`, `getEventDispatcher()`, 
`isUsingPOMsFromFilesystem()` | 0 | none |
   
   maven-plugin-testing shows up on most lines because its stubs override the 
deprecated methods.
   
   ## 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`, 
`getSortedProjects()` and the `MavenSession` lookups.
   - [ ] 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 13 repositories to 
`getArtifacts()` with a scope filter.
   - [ ] `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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to