MaxonT opened a new pull request, #1460:
URL: https://github.com/apache/maven-javadoc-plugin/pull/1460

   Hi, I read through the issue and wrote a fix; happy to adjust it.
   
   ### Description
   
   `ResourceResolver` called the deprecated `MavenProject.getTestArtifacts()` 
in two places, `resolveDependencyJavadocBundles` and 
`resolveDependencyResourceBundles`. In maven-core 3.9.16 that method returns 
the project's `getArtifacts()` filtered by 
`artifact.getArtifactHandler().isAddedToClasspath()` (I read the bytecode with 
`javap`), so a plain `getArtifacts()` would also pull in artifacts of types 
like `pom` that are not on the classpath. This change adds one private helper, 
`classpathArtifacts(MavenProject)`, that applies the same filter to 
`getArtifacts()`, and both call sites use it. The result is the same artifacts 
in the same order: `getArtifacts()` is a `LinkedHashSet`, and the old method 
copied it in that order too.
   
   This covers only the `getTestArtifacts()` part of #1459. I left the 
`getDependencyArtifacts()` uses in `AbstractJavadocMojo` and the 
`setDependencyArtifacts()` calls in `JavadocReportTest` alone: "getArtifacts() 
narrowed to the direct dependencies" has to be matched against the declared 
dependencies, which looked like a separate behaviour question worth its own PR. 
The helper is private, so no public signature, config or output changes.
   
   ### Validation
   
   `mvn -B clean verify` on this head with JDK 21.0.8 and Maven 3.9.x on macOS: 
exit 1, 86 tests run, 7 failures, 8 skipped. The same command on unchanged 
`master` gives the identical result, the same 7 failures 
(`JavadocUtilTest.testPrunePaths`, `JavadocUtilTest.testCopyJavadocResources`, 
`JavadocReportTest.testHelpfile`, `testJavadocResources`, 
`testJavadocResourcesWithExcludes`, `testStylesheetfile`, and 
`AggregatorJavadocReportTest.testAggregateJavadocResources`). The other tests 
pass, and spotless and the RAT check pass. I did not find the cause of those 7 
failures on my machine, and because several of them are resource and bundle 
tests, this change is not exercised by a passing test. I did not add a test, 
and I did not run the integration tests separately. I did not try other JDKs 
beyond a run on JDK 25 that gave the same 7 failures with and without the 
change.
   
   Part of #1459. Part of apache/maven#14157.


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