Repository navigation
Conversation
CheckDependencySnapshotsPhase and GenerateReleasePomsPhase read the direct dependency, report plugin and build extension artifacts through a new ProjectArtifacts helper instead of getDependencyArtifacts(), getReportArtifacts(), getReportArtifactMap(), getExtensionArtifacts() and getExtensionArtifactMap(). The direct dependencies are getArtifacts() narrowed by dependency trail; report plugins and extensions are read from the model and built the way Maven 3 builds them. AbstractReleaseTestCase no longer uses ArtifactFactory, ArtifactRepository, ArtifactRepositoryLayout, ArtifactRepositoryPolicy or get/ setDependencyArtifacts(). Build extensions, which are resolved from the plugin repositories, are read from a copy of the test repository chained after the local repository. Closes apache#1547 Signed-off-by: Shubham <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1547.
This replaces the Maven API that has been deprecated since Maven 3 and is listed in the issue. Behaviour and parameters stay the same.
Main code
phase/ProjectArtifacts:getDirectDependencyArtifacts:getArtifacts()narrowed to the direct dependencies, meaning artifacts whose dependency trail is the project followed by the artifact. This is the same approach as Replace deprecated MavenProject.getDependencyArtifacts() with getArtifacts() narrowed to direct dependencies maven-war-plugin#695.getReportPluginArtifacts/getReportPluginArtifactMap: read from the model's<reporting>plugins, not fromgetReportPlugins(), which is itself deprecated in 3.9.16. Each artifact is built the way Maven 3 builds it:maven-pluginat the declared version, orRELEASEwhen there is no version, with runtime scope.getExtensionArtifacts/getExtensionArtifactMap: read fromgetBuildExtensions(), as ajarat the declared version orRELEASE.CheckDependencySnapshotsPhaseandGenerateReleasePomsPhasenow call the helper. The extension map is computed once, before the loop, instead of once per extension.Test code (
AbstractReleaseTestCase)DefaultArtifactplusArtifactHandlerManager, and set withsetArtifacts().ArtifactFactoryandget/setDependencyArtifacts()are gone.ArtifactRepository,MavenArtifactRepository,ArtifactRepositoryLayoutandArtifactRepositoryPolicyare gone. The local repository is now a plainFileused by the resolver session.ChainedLocalRepositoryManager. It reads from a copy ofsrc/test/remote-repositoryintarget/after the local repository. It uses a copy because the resolver writes base-version files next to the timestamped snapshots it finds.GenerateReleasePomsPhaseTestcomparisons.centralkeeps central's disabled snapshot policy, so the snapshot extension could not be resolved.ProjectArtifactsTestcovers the direct-dependency filter and the report plugin and extension artifacts, with and without versions.How I tested it (JDK 21, Maven 3.9)
mvn -B clean verify -Prun-itspasses:-Dmaven.compiler.showDeprecation=trueno longer reports any of the APIs listed in the issue. The only deprecation left inAbstractReleaseTestCaseis the existingSimpleLocalRepositoryManagerFactoryconstructor from Resolver, which the issue does not cover.spotless:applywas run.