shuseng8 opened a new pull request, #1548:
URL: https://github.com/apache/maven-release/pull/1548

   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**
   
   - New package-private helper `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 apache/maven-war-plugin#695.
     - `getReportPluginArtifacts`/`getReportPluginArtifactMap`: read from the 
model's `<reporting>` plugins, not from `getReportPlugins()`, which is itself 
deprecated in 3.9.16. Each artifact is built the way Maven 3 builds it: 
`maven-plugin` at the declared version, or `RELEASE` when there is no version, 
with runtime scope.
     - `getExtensionArtifacts`/`getExtensionArtifactMap`: read from 
`getBuildExtensions()`, as a `jar` at the declared version or `RELEASE`.
   - `CheckDependencySnapshotsPhase` and `GenerateReleasePomsPhase` now call 
the helper. The extension map is computed once, before the loop, instead of 
once per extension.
   
   **Test code (`AbstractReleaseTestCase`)**
   
   - The direct dependency artifacts are now created with `DefaultArtifact` 
plus `ArtifactHandlerManager`, and set with `setArtifacts()`. `ArtifactFactory` 
and `get/setDependencyArtifacts()` are gone.
   - `ArtifactRepository`, `MavenArtifactRepository`, 
`ArtifactRepositoryLayout` and `ArtifactRepositoryPolicy` are gone. The local 
repository is now a plain `File` used by the resolver session.
   - Without request-level plugin repositories, the projects' build extensions 
(which Maven resolves from the plugin repositories) are found through a 
`ChainedLocalRepositoryManager`. It reads from a copy of 
`src/test/remote-repository` in `target/` after the local repository. It uses a 
copy because the resolver writes base-version files next to the timestamped 
snapshots it finds.
   - I tried two alternatives first and both broke tests:
     - Adding a plugin repository to the test profile changed the generated 
release POMs, which broke 23 `GenerateReleasePomsPhaseTest` comparisons.
     - A mirror for `central` keeps central's disabled snapshot policy, so the 
snapshot extension could not be resolved.
   - New `ProjectArtifactsTest` covers 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-its` passes:
     - maven-release-manager: 778 tests, 0 failures, 18 skipped.
     - maven-release-plugin: 78 unit tests pass.
     - Integration tests: 52 passed, 0 failed, 4 skipped.
   - Compiling with `-Dmaven.compiler.showDeprecation=true` no longer reports 
any of the APIs listed in the issue. The only deprecation left in 
`AbstractReleaseTestCase` is the existing `SimpleLocalRepositoryManagerFactory` 
constructor from Resolver, which the issue does not cover.
   - `spotless:apply` was run.
   
   ---
   
   - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
   - [ ] I hereby declare that I have filed an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
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