philippe-granet opened a new issue, #11381:
URL: https://github.com/apache/maven/issues/11381

   ### Affected version
   
   Apache Maven 4.0.0-SNAPSHOT (b7f91787195232cb9aee404f4fc13dadc04d6ecb)
   
   ### Bug description
   
   With Maven 3.9.x and this configuration:
   ```
       <build>
           <resources>
               <resource>
                   <directory>${project.basedir}/rest</directory>
                   <targetPath>target-dir</targetPath>
                   <includes>
                       <include>**/*.yml</include>
                   </includes>
               </resource>
           </resources>
       </build>
   ```
   all files `rest/**/*.yml` are copied to `target/classes/target-dir`:
   ```
   [INFO] --- resources:3.3.1:resources (default-resources) @ project1 ---
   [INFO] Copying 36 resources from rest to target/classes/target-dir
   ```
   
   But with Maven 4, with same version of Maven resources plugin, all files 
`rest/**/*.yml` are copied to root dir `target-dir`:
   ```
   [INFO] --- resources:3.3.1:resources (default-resources) @ project1---
   [INFO] Copying 36 resources from rest to target-dir
   [INFO] ---------------------------------------------
   ```
   It seams that relative targetPath is not the same as in Maven 3.9.x
   
   A workaround is to prefix `targetPath` with 
`${project.build.outputDirectory}/`, it works both on Maven 3 and 4:
   ```
       <build>
           <resources>
               <resource>
                   <directory>${project.basedir}/rest</directory>
                   
<targetPath>${project.build.outputDirectory}/target-dir</targetPath>
                   <includes>
                       <include>**/*.yml</include>
                   </includes>
               </resource>
           </resources>
       </build>
   ```
   
   


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