This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 75575cd3 Use Java 7 relativization instead of hand-rolled code (#385)
75575cd3 is described below

commit 75575cd34acee592653dfe13ba06710286f0daf4
Author: Elliotte Rusty Harold <elh...@users.noreply.github.com>
AuthorDate: Thu Jun 5 10:35:29 2025 +0000

    Use Java 7 relativization instead of hand-rolled code (#385)
    
    * Use JDK 7 relativization instead of hand-rolled code
---
 .../java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java 
b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index 7c3cb593..42a20b9d 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -142,7 +142,6 @@ import static 
org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
 import static org.apache.maven.plugins.javadoc.JavadocUtil.isEmpty;
 import static org.apache.maven.plugins.javadoc.JavadocUtil.isNotEmpty;
 import static org.apache.maven.plugins.javadoc.JavadocUtil.toList;
-import static org.apache.maven.plugins.javadoc.JavadocUtil.toRelative;
 
 /**
  * Base class with the majority of Javadoc functionality.
@@ -5876,8 +5875,10 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
         options.setTags(toList(tags));
 
         if (getProject() != null && getJavadocDirectory() != null) {
-            options.setJavadocResourcesDirectory(
-                    toRelative(getProject().getBasedir(), 
getJavadocDirectory().getAbsolutePath()));
+            Path basedir = getProject().getBasedir().toPath();
+            Path javadocDirectory = 
getJavadocDirectory().toPath().toAbsolutePath();
+            Path javadocResourcesDirectory = 
basedir.relativize(javadocDirectory);
+            
options.setJavadocResourcesDirectory(javadocResourcesDirectory.toString());
         }
 
         File optionsFile = getJavadocOptionsFile();

Reply via email to