This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jmod-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 4a13ba6  Fix jmod-plugin ITs for Maven 4.0.0-rc-5 compatibility (#106)
4a13ba6 is described below

commit 4a13ba6c8f2706229a1e92f6c2db59e0cbcd32ee
Author: Gerd Aschemann <[email protected]>
AuthorDate: Sun Jun 14 20:42:14 2026 +0200

    Fix jmod-plugin ITs for Maven 4.0.0-rc-5 compatibility (#106)
    
    Two root causes; both IT-only, no plugin source change.
    
    1. mjmod-20-set-main-class and mjmod-23-path-must-be-dir leave
       maven-jar-plugin un-pinned in <pluginManagement>, so Maven 4
       picks its hard-coded 4.0.0-beta-1 default whose
       Project.getPomArtifact() call throws NoSuchMethodError against
       rc-5+ APIs. Pin to maven-jar-plugin:3.4.2 (works on both lanes).
    
    2. Five ITs (describe-base-config, list-plain, list-base-config,
       mjmod-20-set-main-class, mjmod-23-path-must-be-dir) scrape
       build.log for jmod output between '[INFO] The following ...' /
       '[INFO] <module>@<ver>' and the next '[INFO] ---'. Maven 4 inserts
       '[INFO] Copying ... to project local repository' and
       '[DEBUG] Reading file model from ...' lines into that block;
       tighten the findAll{} filter to reject them so the asserted Set
       stays equal to the jmod-only expectation.
    
    Verified: 'mvn -P run-its clean verify' green on both 4.0.0-rc-5
    and 3.9.9 (Passed: 18, Failed: 0 on both lanes), macOS aarch64 JDK
    17 Temurin.
    
    Builds on top of @Bukama's open PR #101 (workflow flip enabling
    the rc-5 matrix) which is necessary but not sufficient by itself.
---
 .github/workflows/maven-verify.yml             |  2 ++
 src/it/describe-base-config/verify.groovy      |  8 ++++++--
 src/it/list-base-config/verify.groovy          |  4 ++++
 src/it/list-plain/verify.groovy                |  4 ++++
 src/it/mjmod-20-set-main-class/pom.xml         | 10 ++++------
 src/it/mjmod-20-set-main-class/verify.groovy   |  6 +++++-
 src/it/mjmod-23-path-must-be-dir/pom.xml       | 10 +++++++++-
 src/it/mjmod-23-path-must-be-dir/verify.groovy |  6 +++++-
 8 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/maven-verify.yml 
b/.github/workflows/maven-verify.yml
index 932827c..ce4b500 100644
--- a/.github/workflows/maven-verify.yml
+++ b/.github/workflows/maven-verify.yml
@@ -25,3 +25,5 @@ jobs:
   build:
     name: Verify
     uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
+    with:
+      maven4-enabled: true
diff --git a/src/it/describe-base-config/verify.groovy 
b/src/it/describe-base-config/verify.groovy
index cb61e39..adf5fc1 100644
--- a/src/it/describe-base-config/verify.groovy
+++ b/src/it/describe-base-config/verify.groovy
@@ -26,9 +26,13 @@ def expectedDescriptorLines = [
 def buildLog = new File (basedir, 'build.log')
 
 def describeLines = buildLog.readLines()
-                            .dropWhile{ it != '[INFO] 
[email protected]' } 
+                            .dropWhile{ it != '[INFO] 
[email protected]' }
                             .takeWhile{ !it.startsWith('[INFO] ---') }
-                            .grep()
+                            // Maven 4 emits install-related '[INFO] Copying 
... to project local repository'
+                            // lines and '[DEBUG] Reading file model from ...' 
lines between the jmod
+                            // describe output and the next mojo header; 
restrict to '[INFO]' lines and
+                            // reject Copying lines so neither leaks into the 
asserted Set.
+                            .findAll{ it.startsWith('[INFO] ') && 
!it.startsWith('[INFO] Copying ') }
                             .collect{ it - '[INFO] ' } as Set
 
 assert expectedDescriptorLines == describeLines
diff --git a/src/it/list-base-config/verify.groovy 
b/src/it/list-base-config/verify.groovy
index a854396..dd125ed 100644
--- a/src/it/list-base-config/verify.groovy
+++ b/src/it/list-base-config/verify.groovy
@@ -30,6 +30,10 @@ def listLines = buildLog.readLines()
                             .drop(1)
                             .takeWhile{ !it.startsWith('[INFO] ---') }
                             .findAll{ it.startsWith('[INFO] ')}
+                            // Maven 4 emits install-related '[INFO] Copying 
... to project local repository'
+                            // lines between the jmod plugin's output and the 
next mojo header; reject
+                            // them so they don't leak into the asserted Set.
+                            .findAll{ !it.startsWith('[INFO] Copying ') }
                             .collect{ it - '[INFO] ' } as Set
 
 assert listLines == resourceNames
diff --git a/src/it/list-plain/verify.groovy b/src/it/list-plain/verify.groovy
index a854396..dd125ed 100644
--- a/src/it/list-plain/verify.groovy
+++ b/src/it/list-plain/verify.groovy
@@ -30,6 +30,10 @@ def listLines = buildLog.readLines()
                             .drop(1)
                             .takeWhile{ !it.startsWith('[INFO] ---') }
                             .findAll{ it.startsWith('[INFO] ')}
+                            // Maven 4 emits install-related '[INFO] Copying 
... to project local repository'
+                            // lines between the jmod plugin's output and the 
next mojo header; reject
+                            // them so they don't leak into the asserted Set.
+                            .findAll{ !it.startsWith('[INFO] Copying ') }
                             .collect{ it - '[INFO] ' } as Set
 
 assert listLines == resourceNames
diff --git a/src/it/mjmod-20-set-main-class/pom.xml 
b/src/it/mjmod-20-set-main-class/pom.xml
index 2640e9e..4bf9c40 100644
--- a/src/it/mjmod-20-set-main-class/pom.xml
+++ b/src/it/mjmod-20-set-main-class/pom.xml
@@ -44,26 +44,24 @@
     </dependencyManagement>
 
     <build>
-        <pluginManagement><!-- lock down plugins versions to avoid using Maven 
defaults (may be moved to parent pom) -->
+        <pluginManagement><!-- lock down plugins versions to avoid using Maven 
defaults -->
             <plugins>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-compiler-plugin</artifactId>
-                    <!-- When this version is not set to 3.8.0, but to 
@version.maven-compiler-plugin@ then jar-plugin 4.0.0-beta gets pulled in which 
is not defined anywhere, but is the latest in my local repository.
-                    4.0.0-beta ofc is not compatible with Maven 3.9.x.
-                    if you then set the jar-plugin to 
@version.maven-jar-plugin@, the java module (of the module-info) gets not found 
-->
                     <version>3.8.0</version>
                     <configuration>
                         <release>9</release>
                     </configuration>
                 </plugin>
-                <!--
+                <!-- Pin maven-jar-plugin to the GA tracked by apache-parent. 
Without this,
+                     Maven 4 picks 4.0.0-beta-1 (the highest non-snapshot on 
Central) whose
+                     Project.getPomArtifact() call throws NoSuchMethodError 
against rc-5+ APIs. -->
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-jar-plugin</artifactId>
                     <version>@version.maven-jar-plugin@</version>
                 </plugin>
-                -->
             </plugins>
         </pluginManagement>
         <plugins>
diff --git a/src/it/mjmod-20-set-main-class/verify.groovy 
b/src/it/mjmod-20-set-main-class/verify.groovy
index 2e4af4e..5886d7e 100644
--- a/src/it/mjmod-20-set-main-class/verify.groovy
+++ b/src/it/mjmod-20-set-main-class/verify.groovy
@@ -28,7 +28,11 @@ def buildLog = new File(basedir,'build.log')
 def describeLines = buildLog.readLines()
                             .dropWhile{ it != '[INFO] 
[email protected]' } // start line, inclusive
                             .takeWhile{ !it.startsWith('[INFO] ---') }         
   // end line, inclusive
-                            .grep()                                            
   // remove empty lines
+                            // Maven 4 emits install-related '[INFO] Copying 
... to project local repository'
+                            // lines and '[DEBUG] Reading file model from ...' 
lines between the jmod
+                            // describe output and the next mojo header; 
restrict to '[INFO]' lines and
+                            // reject Copying lines so neither leaks into the 
asserted Set.
+                            .findAll{ it.startsWith('[INFO] ') && 
!it.startsWith('[INFO] Copying ') }
                             .collect{ it - '[INFO] ' } as Set                  
      // strip loglevel
 
 def expectedLines = [
diff --git a/src/it/mjmod-23-path-must-be-dir/pom.xml 
b/src/it/mjmod-23-path-must-be-dir/pom.xml
index 0b42c67..9ca2d73 100644
--- a/src/it/mjmod-23-path-must-be-dir/pom.xml
+++ b/src/it/mjmod-23-path-must-be-dir/pom.xml
@@ -43,7 +43,7 @@
     </dependencyManagement>
 
     <build>
-        <pluginManagement><!-- lock down plugins versions to avoid using Maven 
defaults (may be moved to parent pom) -->
+        <pluginManagement><!-- lock down plugins versions to avoid using Maven 
defaults -->
             <plugins>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
@@ -53,6 +53,14 @@
                         <release>9</release>
                     </configuration>
                 </plugin>
+                <!-- Pin maven-jar-plugin to the GA tracked by apache-parent. 
Without this,
+                     Maven 4 picks 4.0.0-beta-1 (the highest non-snapshot on 
Central) whose
+                     Project.getPomArtifact() call throws NoSuchMethodError 
against rc-5+ APIs. -->
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <version>@version.maven-jar-plugin@</version>
+                </plugin>
             </plugins>
         </pluginManagement>
         <plugins>
diff --git a/src/it/mjmod-23-path-must-be-dir/verify.groovy 
b/src/it/mjmod-23-path-must-be-dir/verify.groovy
index d83ee3d..26ee6f9 100644
--- a/src/it/mjmod-23-path-must-be-dir/verify.groovy
+++ b/src/it/mjmod-23-path-must-be-dir/verify.groovy
@@ -37,7 +37,11 @@ def buildLog = new File(basedir,'build.log')
 def describeLines = buildLog.readLines()
                             .dropWhile{ it != '[INFO] 
[email protected]' } // start line, inclusive
                             .takeWhile{ !it.startsWith('[INFO] ---') }         
   // end line, inclusive
-                            .grep()                                            
   // remove empty lines
+                            // Maven 4 emits install-related '[INFO] Copying 
... to project local repository'
+                            // lines and '[DEBUG] Reading file model from ...' 
lines between the jmod
+                            // describe output and the next mojo header; 
restrict to '[INFO]' lines and
+                            // reject Copying lines so neither leaks into the 
asserted Set.
+                            .findAll{ it.startsWith('[INFO] ') && 
!it.startsWith('[INFO] Copying ') }
                             .collect{ it - '[INFO] ' } as Set                  
      // strip loglevel
 
 def expectedLines = [

Reply via email to