gnodet opened a new pull request, #530:
URL: https://github.com/apache/maven-resources-plugin/pull/530

   ## Problem
   
   When a user sets `<outputDirectory>` at the plugin level (not tied to a 
specific execution id), the setting applies to **all goals** of the plugin, 
including `testResources`. This causes test resources to be copied to the main 
output directory (`target/classes`) instead of the test output directory 
(`target/test-classes`), and they end up in the production WAR/JAR.
   
   Example of the problematic configuration:
   ```xml
   <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-resources-plugin</artifactId>
     <configuration>
       <!-- ⚠️ This also overrides testResources' output directory! -->
       <outputDirectory>${project.build.outputDirectory}</outputDirectory>
     </configuration>
   </plugin>
   ```
   
   ## Root Cause
   
   `TestResourcesMojo` declares its own `outputDirectory` field (with default 
`${project.build.testOutputDirectory}`) shadowing 
`ResourcesMojo.outputDirectory`. A global plugin-level `<configuration>` block 
is applied to both goals, overriding the test mojo's `testOutputDirectory` 
default with the configured value.
   
   ## Fix
   
   Improve the Javadoc on both `ResourcesMojo.outputDirectory` and 
`TestResourcesMojo.outputDirectory` to:
   - Explain the issue
   - Show the correct pattern (scope configuration to a specific execution id)
   
   The correct configuration is:
   ```xml
   <executions>
     <execution>
       <id>default-resources</id>
       <configuration>
         <outputDirectory>/custom/output</outputDirectory>
       </configuration>
     </execution>
   </executions>
   ```
   
   Fixes #329


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