Irasha-Senarathna opened a new pull request, #358:
URL: https://github.com/apache/maven-remote-resources-plugin/pull/358

   Fixes #357
   
   `getDirectDependencies()` called the deprecated 
`MavenProject.getDependencyArtifacts()` in 
`AggregateProcessRemoteResourcesMojo` (listed in the issue) and in 
`ProcessRemoteResourcesMojo` (not listed, same problem). It is only used when 
`excludeTransitive=true`.
   
   Both mojos now take `project.getArtifacts()` and keep the artifacts whose 
dependency trail has two entries. Maven core starts the trail with the project 
and ends it with the artifact, so two entries means a direct dependency. Both 
mojos declare `requiresDependencyResolution = TEST`, so the artifacts and their 
trails are always set.
   
   The aggregate mojo filters each reactor project before it merges them. An 
artifact can be direct in one module and transitive in another. The two 
artifacts are equal, so only one survives the merge, and it can be the 
transitive one.
   
   Test changes:
   - Nothing tested `excludeTransitive`. I added one test for `process` and one 
for `aggregate`, and wrote them before the change. They pass on the old and the 
new code and fail with `excludeTransitive=false`. The aggregate test also fails 
if the mojo merges before it filters.
   - `stub/ArtifactStub` implemented `Artifact`, which forced the deprecated 
`ArtifactMetadata` and `ArtifactRepository` types into the tests. It is 
replaced with `DefaultArtifact` and deleted.
   - `testProjectsDoesNotMutateProjectArtifactVersions` now uses a timestamped 
snapshot (`1.0-20260926.120000-1`). With plain `1.0-SNAPSHOT`, the base version 
is the same as the version, so the test would not catch the #268 regression. I 
checked that it still fails with that bug reintroduced.
   - `MavenProjectBasicStub` no longer calls the deprecated 
`setDependencyArtifacts`, `setReportArtifacts` or `setExtensionArtifacts`.
   
   No parameters or behavior change.
   
   Still deprecated, in tests only: Maven 3.9 has no non-deprecated 
`MavenSession` constructor. The new aggregate test uses the same constructor as 
the existing `testGetProjectsBuildsOnlyExternalArtifacts`. I can switch both 
tests to a Mockito mock if you prefer, but that needs a declared `mockito-core` 
test dependency.
   
   `mvn -Prun-its verify` on JDK 21 with Maven 3.10.2 passes: 59 unit tests, 12 
failsafe ITs and 7 invoker ITs. CI covers Maven 4.
   
   ---
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 
2004](https://www.apache.org/licenses/LICENSE-2.0)
   check one of the following:
   
   - [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