jhkang0516 opened a new pull request, #1437: URL: https://github.com/apache/maven-javadoc-plugin/pull/1437
Fixes #1436. The failure on rerun is a plugin bug, not only test state: an up-to-date build deletes javadoc pages generated by the previous run. `copyAllResources()` runs before the stale-data check. `JavadocUtil.copyJavadocResources` copied each `resources` / `**/doc-files` directory and then deleted everything matching the `excludedocfilessubdir` patterns (`**/<name>/**`) from the output subtree. In `resources-with-excludes-test`, `src/main/javadoc/resources` maps to `apidocs/resources`, which is also where javadoc writes the pages for package `resources.test`, so `excludedocfilessubdir=test` removed `apidocs/resources/test/**`. The second run then found the javadoc up to date and did not regenerate it, leaving `App.html` missing. Excluded entries are now skipped while copying instead of being deleted from the output afterwards, so the copy never touches files it did not write. On a fresh output directory the result is the same as before (same Ant patterns relative to the same base, default excludes, empty directories, case-sensitive matching). Behaviour changes worth noting: - A resource that was copied by an earlier build and is excluded now stays in the output until a clean build; exclusion means "do not copy this input" rather than "delete matching paths from the merged output". - Later bundle/module copies in an aggregate build no longer delete matching files contributed by earlier ones. - Output already damaged by the old code is not repaired: `StaleHelper` only records the top-level entries of the output directory, so it still reports the incomplete javadoc as up to date. One clean build fixes it; making the stale check detect nested changes is out of scope here. Tests: - `JavadocUtilTest#testCopyJavadocResourcesKeepsExistingOutput` puts a generated page under a path that matches the exclude and checks it survives the copy. - `JavadocReportTest#testJavadocResourcesWithExcludes` now cleans its fixture output first, executes the mojo twice, asserts the output after each run, and checks that the second run took the up-to-date path. Both fail without the fix. Verified: `mvn -B verify` on JDK 21, twice in a row without `clean` → Tests run: 84, Failures: 0, Errors: 0, Skipped: 8 both times. `mvn -B -P run-its verify -Dinvoker.test='MJAVADOC-259,MJAVADOC-320,MJAVADOC-338_downloadSources,MJAVADOC-767,dependencySource-*'` (the ITs that copy doc-files or dependency javadoc resources) → Passed: 8, Failed: 0. --- 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]
