desruisseaux opened a new pull request, #11322:
URL: https://github.com/apache/maven/pull/11322

   The specification that we wrote in `maven.mdo` said about the `<targetPath> 
element:
   
   > Specifies an explicit target path, overriding the default value. The path 
is relative to the `${project.build.outputDirectory}` directory, which is 
typically `target/classes` in a Java project.
   
   However, the implementation in the `DefaultSourceRoot(Session session, Path 
baseDir, Source source)` constructor resolves against `baseDir`, which is not 
even inside `target`.
   
   Furthermore, the specification is incomplete. The default directory should 
be `target/classes` when the scope is "main", but should be 
`target/test-classes` when the scope is "test". The current specification said 
nothing about the fact that the default value depends on the scope.
   
   This pull requests is divided in 3 commits. The first commit is only a 
trivial javadoc fixes. The second commit refactors the `DefaultSourceRoot` 
implementation as a Java record, but without significant changes in its 
behaviour. The benefit of using record is to reduce the boiler plate (code side 
is reduced by about one third), and it also forces us to be more rigorous since 
all constructions must pass by the canonical constructor. Then, the last commit 
is the one that actually fixes the issue described above.


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