You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "slachiewicz (via GitHub)" <gi...@apache.org> on 2026/08/04 11:31:02 UTC

[PR] Build against Maven 4.0.0-rc-6, and honour on testResources [maven-resources-plugin]

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

   Moves `mavenVersion` to the current RC and pins the same version explicitly in the Verify workflow.
   
   That surfaced a pre-existing bug. `MRESOURCES-131` sets `<skip>true</skip>` in `pluginManagement` and asserts the test resource is not copied; it has been failing since **4.0.0-rc-5** — main resources skips, `testResources` does not:
   
   ```
   --- resources:resources (default-resources) ---
   [INFO] Skipping the execution.
   --- resources:testResources (default-testResources) ---
   [INFO] Copying 1 resource from src/test/resources to target/test-classes
   ```
   
   `ResourcesMojo` and `TestResourcesMojo` both declare a private field named `skip`. They collapse into a single descriptor parameter for the `testResources` goal, and the configurator writes the superclass field — so `TestResourcesMojo`'s own field stays `false` whatever the build configured, and its guard never fires. Reading both restores the documented behaviour while keeping `maven.test.skip` and `maven.resources.skip` working as before.
   
   Renaming the field so the two stop shadowing is not an option: the descriptor generator then sees two parameters called `skip` for one goal and fails with `skip has been declared multiple times in mojo with goal: testResources`.
   
   `mvn verify -Prun-its` passes, 24 unit tests, 0 failures. Part of apache/maven#12676. Verified green on a fork before opening.


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Build against Maven 4.0.0-rc-6, and honour on testResources [maven-resources-plugin]

Posted by "desruisseaux (via GitHub)" <gi...@apache.org>.
desruisseaux commented on code in PR #500:
URL: https://github.com/apache/maven-resources-plugin/pull/500#discussion_r3712411021


##########
src/main/java/org/apache/maven/plugins/resources/TestResourcesMojo.java:
##########
@@ -62,7 +62,12 @@ public class TestResourcesMojo extends ResourcesMojo {
      * {@inheritDoc}
      */
     public void execute() throws MojoException {
-        if (skip) {
+        // isSkip() reads ResourcesMojo's own field. Both classes declare a private
+        // "skip", so the two collapse into a single descriptor parameter and the
+        // configurator writes the superclass one, leaving this class's field false
+        // however the build configured <skip>. Reading both is what makes
+        // <skip>true</skip> reach this goal at all.
+        if (skip || isSkip()) {

Review Comment:
   This is a temporary workaround until https://github.com/apache/maven/pull/12626 is available in a Maven release, isn'it?



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Build against Maven 4.0.0-rc-6, and honour on testResources [maven-resources-plugin]

Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz merged PR #500:
URL: https://github.com/apache/maven-resources-plugin/pull/500


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Build against Maven 4.0.0-rc-6, and honour on testResources [maven-resources-plugin]

Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz commented on code in PR #500:
URL: https://github.com/apache/maven-resources-plugin/pull/500#discussion_r3712533385


##########
src/main/java/org/apache/maven/plugins/resources/TestResourcesMojo.java:
##########
@@ -62,7 +62,12 @@ public class TestResourcesMojo extends ResourcesMojo {
      * {@inheritDoc}
      */
     public void execute() throws MojoException {
-        if (skip) {
+        // isSkip() reads ResourcesMojo's own field. Both classes declare a private
+        // "skip", so the two collapse into a single descriptor parameter and the
+        // configurator writes the superclass one, leaving this class's field false
+        // however the build configured <skip>. Reading both is what makes
+        // <skip>true</skip> reach this goal at all.
+        if (skip || isSkip()) {

Review Comment:
   Yes, exactly — thanks, I had not spotted that PR. Added a `TODO` at that line pointing at apache/maven#12626, so the workaround carries the condition for its own removal: once that fix is in a release the configurator writes this class's own field and the `isSkip()` half can go.
   
   Keeping the workaround for now since it makes `MRESOURCES-131` pass on the currently released Maven — the IT has been failing since 4.0.0-rc-5.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org