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

   The plugin had a compile dependency on `wagon-provider-api` to reach exactly 
one utility method, `PathUtils.toRelative`, at two call sites. Nothing else in 
the plugin touches Wagon, and the plugin never transfers anything over it.
   
   ### Why the method is copied rather than replaced with `Path.relativize`
   
   Its behaviour is particular, and both call sites depend on it:
   
   ```java
   String javadocDirRelative = toRelative(project.getBasedir(), 
getJavadocDirectory().getAbsolutePath());
   File javadocDir = new File(subProject.getBasedir(), javadocDirRelative);
   ```
   
   The result is reapplied to a *sibling* project's base directory. When the 
input path does not lie under the base directory, the original returns it 
**unchanged**; `Path.relativize` would instead produce a chain of `..` 
segments, which would then be resolved against the sibling and point somewhere 
else entirely. It also answers `"."` for the base directory itself and 
normalises backslashes.
   
   So the fifteen lines are reproduced as a package-private static, with four 
tests pinning the cases — including the outside-the-basedir one that differs 
from `relativize`, which is the one a future refactor would most plausibly get 
wrong.
   
   ### Verification
   
   `mvn test`: 65 tests, 1 failure before and after — the same test, 
`JavadocReportTest.testJavadocResourcesWithExcludes`, which already fails on an 
untouched checkout in my environment. The failure set is byte-identical before 
and after, so this change is neutral to it.
   
   `AbstractJavadocMojoTest`: 6 tests, 0 failures, of which 4 are new.
   
   ### Scope
   
   The test-scoped `wagon-http` is untouched — it exists to give Resolver a 
transport in tests and is a separate matter.
   
   This came out of a survey of how Maven projects actually depend on Wagon. 
Two other projects use `wagon-provider-api` the same way, purely for small 
helpers rather than transport: maven-jxr-plugin for `Repository` URL parsing, 
and maven-plugin-tools-api for `ProxyUtils.validateNonProxyHosts`.
   


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