desruisseaux commented on code in PR #11394:
URL: https://github.com/apache/maven/pull/11394#discussion_r2501101236


##########
impl/maven-core/src/main/java/org/apache/maven/project/ConnectedResource.java:
##########
@@ -42,13 +42,53 @@ class ConnectedResource extends Resource {
                 .includes(sourceRoot.includes())
                 .excludes(sourceRoot.excludes())
                 .filtering(Boolean.toString(sourceRoot.stringFiltering()))
-                
.targetPath(sourceRoot.targetPath().map(Path::toString).orElse(null))
+                .targetPath(computeRelativeTargetPath(sourceRoot, scope, 
project))
                 .build());
         this.originalSourceRoot = sourceRoot;
         this.scope = scope;
         this.project = project;
     }
 
+    /**
+     * Computes the targetPath relative to the output directory.
+     * In Maven 3 API, Resource.getTargetPath() is expected to be relative to 
the output directory
+     * (e.g., "custom-output"), while SourceRoot.targetPath() is relative to 
the project basedir

Review Comment:
   > while SourceRoot.targetPath() is relative to the project basedir
   
   Actually it was a bug. The specification that we wrote in `maven.mdo` said 
that `targetPath` shall be relative to the target directory. Fixing that bug 
was the subject of #11322, but that correction was incomplete. We could said 
that this pull request #11394 completes #11322.



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