You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/09/20 11:19:46 UTC

(maven-invoker-plugin) 02/02: Port the IT scripts from BeanShell to Groovy

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-invoker-plugin.git

commit dcff5f7278f10e9ea81fa0b2be7d01569b4dbd03
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Sep 20 12:38:47 2026 +0200

    Port the IT scripts from BeanShell to Groovy
    
    BeanShell is being retired across Maven (apache/maven#13207); the scripts
    keep the same checks. The beanshell/ fixtures inside the script-* ITs stay
    as they are: they exercise the plugin's own interpreter detection and are
    the coverage for the engine until it is removed.
---
 src/it/filtering-extensions/verify.groovy            |  8 ++++----
 src/it/install-extra-artifacts/verify.groovy         |  4 ++--
 src/it/invocation-project/pom.xml                    |  2 +-
 .../invocation-project/src/it/project/setup.groovy   |  4 ++--
 src/it/invocation-project/verify.groovy              |  8 ++++----
 src/it/invocation-spaces/verify.groovy               |  4 ++--
 src/it/pom-filtering-encoding/verify.groovy          |  4 ++--
 src/it/pom-filtering-reactor/verify.groovy           |  4 ++--
 src/it/pom-filtering/verify.groovy                   | 10 +++++-----
 src/it/pom-less-invocation/verify.groovy             |  4 ++--
 src/it/project-cloning/verify.groovy                 |  4 ++--
 src/it/script-classpath-duplicates/verify.groovy     |  4 ++--
 src/it/script-interpreter-detection/verify.groovy    |  4 ++--
 src/it/selector-scripts/verify.groovy                | 20 ++++++++++----------
 src/it/staging-dependencies-test-scope/verify.groovy |  4 ++--
 src/it/staging-dependencies/verify.groovy            |  4 ++--
 src/it/staging-pom/verify.groovy                     |  4 ++--
 src/it/staging-reactor/verify.groovy                 |  4 ++--
 18 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/src/it/filtering-extensions/verify.groovy b/src/it/filtering-extensions/verify.groovy
index da0c8a4..9a1d575 100644
--- a/src/it/filtering-extensions/verify.groovy
+++ b/src/it/filtering-extensions/verify.groovy
@@ -36,11 +36,11 @@ try
     String xml = FileUtils.fileRead( extensionsFile, "UTF-8" );
   
 
-    String[] values = {
+    String[] values = [
       "<groupId>org.apache.maven.plugins.invoker</groupId>",
       "<artifactId>pom-filtering</artifactId>",
       "<version>1.0-SNAPSHOT</version>",
-    };
+    ];
     for ( String value : values )
     {
         System.out.println( "Checking for occurrence of: " + value );
@@ -51,11 +51,11 @@ try
         }
     }
 
-    String[] badValues = {
+    String[] badValues = [
         "<groupId>@project.groupId@</groupId>",
         "<artifactId>@project.artifactId@</artifactId>",
         "<version>@project.version@</version>",
-    };
+    ];
     for ( String value : badValues )
     {
         System.out.println( "Checking for absence of: " + value );
diff --git a/src/it/install-extra-artifacts/verify.groovy b/src/it/install-extra-artifacts/verify.groovy
index ba95e36..70e5d9f 100644
--- a/src/it/install-extra-artifacts/verify.groovy
+++ b/src/it/install-extra-artifacts/verify.groovy
@@ -31,7 +31,7 @@ try
     }
 
     String[] files =
-    {
+    [
         "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4.jar",
         "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4.pom",
         "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4-javadoc.jar",
@@ -45,7 +45,7 @@ try
         "jdom/jdom/1.1/jdom-1.1.pom",
         "org/jdom/jdom/1.1/jdom-1.1.pom",
         "org/jdom/jdom/1.1/jdom-1.1.jar",
-    };
+    ];
     for ( String file : files )
     {
         File stagedFile = new File( itRepoDir, file );
diff --git a/src/it/invocation-project/pom.xml b/src/it/invocation-project/pom.xml
index 4d09be0..f796d52 100644
--- a/src/it/invocation-project/pom.xml
+++ b/src/it/invocation-project/pom.xml
@@ -49,7 +49,7 @@ under the License.
             <pomInclude>*/pom.xml</pomInclude>
           </pomIncludes>
           <settingsFile>src/it/settings.xml</settingsFile>
-          <preBuildHookScript>setup.bsh</preBuildHookScript>
+          <preBuildHookScript>setup.groovy</preBuildHookScript>
           <goals>
             <goal>clean</goal>
           </goals>
diff --git a/src/it/invocation-project/src/it/project/setup.groovy b/src/it/invocation-project/src/it/project/setup.groovy
index 5e6d0f0..570ff48 100644
--- a/src/it/invocation-project/src/it/project/setup.groovy
+++ b/src/it/invocation-project/src/it/project/setup.groovy
@@ -20,12 +20,12 @@
 import java.io.*;
 
 String[] paths =
-{
+[
     "target",
     "sub-1/target",
     "sub-2/target",
     "sub-3/target",
-};
+];
 
 for ( String path : paths )
 {
diff --git a/src/it/invocation-project/verify.groovy b/src/it/invocation-project/verify.groovy
index b080a6c..c59928c 100644
--- a/src/it/invocation-project/verify.groovy
+++ b/src/it/invocation-project/verify.groovy
@@ -20,10 +20,10 @@
 import java.io.*;
 
 String[] unexpectedPaths =
-{
+[
     "sub-1/target",
     "sub-3/target",
-};
+];
 
 for ( String path : unexpectedPaths )
 {
@@ -36,10 +36,10 @@ for ( String path : unexpectedPaths )
 }
 
 String[] expectedPaths =
-{
+[
     "target",
     "sub-2/target",
-};
+];
 
 for ( String path : expectedPaths )
 {
diff --git a/src/it/invocation-spaces/verify.groovy b/src/it/invocation-spaces/verify.groovy
index 118fa20..348b663 100644
--- a/src/it/invocation-spaces/verify.groovy
+++ b/src/it/invocation-spaces/verify.groovy
@@ -33,10 +33,10 @@ try
         return false;
     }
 
-    String[] values = {
+    String[] values = [
         "value with spaces from settings",
         "value with spaces from cli",
-    };
+    ];
 
     BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( testFile ), "UTF-8" ) );
     try
diff --git a/src/it/pom-filtering-encoding/verify.groovy b/src/it/pom-filtering-encoding/verify.groovy
index db3c58d..b0784ee 100644
--- a/src/it/pom-filtering-encoding/verify.groovy
+++ b/src/it/pom-filtering-encoding/verify.groovy
@@ -43,11 +43,11 @@ boolean check( String project, String encoding )
 
     String xml = FileUtils.fileRead( pomFile, encoding );
 
-    String[] values = {
+    String[] values = [
             "<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>",
             "<prop0>\u00A9\u00AE\u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF</prop0>",
             "<prop1>\u00A9\u00AE\u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF</prop1>",
-        };
+        ];
     for ( String value : values )
     {
         System.out.println( "Checking for occurrence of: " + value );
diff --git a/src/it/pom-filtering-reactor/verify.groovy b/src/it/pom-filtering-reactor/verify.groovy
index d75e06d..6921bb8 100644
--- a/src/it/pom-filtering-reactor/verify.groovy
+++ b/src/it/pom-filtering-reactor/verify.groovy
@@ -35,9 +35,9 @@ boolean check( String project, boolean filtered )
 
     String xml = FileUtils.fileRead( pomFile, "UTF-8" );
 
-    String[] values = {
+    String[] values = [
             "<prop0>pom-filtering-reactor</prop0>",
-        };
+        ];
     for ( String value : values )
     {
         System.out.println( "Checking for " + ( filtered ? "occurrence" : "absence" ) + " of: " + value );
diff --git a/src/it/pom-filtering/verify.groovy b/src/it/pom-filtering/verify.groovy
index a014c8a..0525f3c 100644
--- a/src/it/pom-filtering/verify.groovy
+++ b/src/it/pom-filtering/verify.groovy
@@ -43,8 +43,8 @@ try
 
     String xml = FileUtils.fileRead( pomFile, "UTF-8" );
 
-    String[] values = {
-            "<prop0>${project.version}</prop0>",
+    String[] values = [
+            '<prop0>${project.version}</prop0>',
             "<prop1>1.0-SNAPSHOT</prop1>",
             "<prop2>PROPERTY-FROM-PLUGIN-CONFIG</prop2>",
             "<prop3>PROPERTY-FROM-PROPERTIES-SECTION</prop3>",
@@ -55,7 +55,7 @@ try
             "<prop8>PASSED</prop8>",
             "<prop10>file:///",
             "<prop12>file:///",
-        };
+        ];
     for ( String value : values )
     {
         System.out.println( "Checking for occurrence of: " + value );
@@ -66,14 +66,14 @@ try
         }
     }
 
-    String[] badValues = {
+    String[] badValues = [
             "<prop9>@basedir@</prop9>",
             "<prop9>FAILED</prop9>",
             "<prop10>@baseurl@</prop10>",
             "<prop10>FAILED</prop10>",
             "<prop11>@localRepository@</prop11>",
             "<prop12>@localRepositoryUrl@</prop12>",
-        };
+        ];
     for ( String value : badValues )
     {
         System.out.println( "Checking for absence of: " + value );
diff --git a/src/it/pom-less-invocation/verify.groovy b/src/it/pom-less-invocation/verify.groovy
index c471382..5f0aaa7 100644
--- a/src/it/pom-less-invocation/verify.groovy
+++ b/src/it/pom-less-invocation/verify.groovy
@@ -30,10 +30,10 @@ try
         return false;
     }
 
-    String[] paths = {
+    String[] paths = [
             "no-pom",
             "no-pom/build.log",
-    };
+    ];
     for ( String path : paths )
     {
         File file = new File( itDir, path );
diff --git a/src/it/project-cloning/verify.groovy b/src/it/project-cloning/verify.groovy
index 63b495a..4568519 100644
--- a/src/it/project-cloning/verify.groovy
+++ b/src/it/project-cloning/verify.groovy
@@ -31,7 +31,7 @@ try
     }
 
     // NOTE: It is part of the test design that "module" is a prefix of "module-1"
-    String[] paths = {
+    String[] paths = [
             "module",
             "module/pom.xml",
             "module-1",
@@ -39,7 +39,7 @@ try
             "module-1/empty-dir",
             "module-1/sub-module",
             "module-1/sub-module/pom.xml",
-    };
+    ];
     for ( String path : paths )
     {
         File file = new File( itDir, path );
diff --git a/src/it/script-classpath-duplicates/verify.groovy b/src/it/script-classpath-duplicates/verify.groovy
index e7a35e5..7155c09 100644
--- a/src/it/script-classpath-duplicates/verify.groovy
+++ b/src/it/script-classpath-duplicates/verify.groovy
@@ -23,12 +23,12 @@ import java.util.regex.*;
 
 try
 {
-    String[] files = {
+    String[] files = [
             "target/it/beanshell/target/created-by-prebuild.bsh",
             "target/it/beanshell/target/created-by-postbuild.bsh",
             "target/it/groovy/target/created-by-prebuild.groovy",
             "target/it/groovy/target/created-by-postbuild.groovy",
-      };
+      ];
     for ( String file : files )
     {
         File touchFile = new File( basedir, file );
diff --git a/src/it/script-interpreter-detection/verify.groovy b/src/it/script-interpreter-detection/verify.groovy
index 8baef9f..45300fd 100644
--- a/src/it/script-interpreter-detection/verify.groovy
+++ b/src/it/script-interpreter-detection/verify.groovy
@@ -23,12 +23,12 @@ import java.util.regex.*;
 
 try
 {
-    String[] files = {
+    String[] files = [
             "target/its/beanshell/target/prebuild.bsh",
             "target/its/beanshell/target/postbuild.bsh",
             "target/its/groovy/target/prebuild.groovy",
             "target/its/groovy/target/postbuild.groovy",
-      };
+      ];
     for ( String file : files )
     {
         File touchFile = new File( basedir, file );
diff --git a/src/it/selector-scripts/verify.groovy b/src/it/selector-scripts/verify.groovy
index 6202104..b91b30b 100644
--- a/src/it/selector-scripts/verify.groovy
+++ b/src/it/selector-scripts/verify.groovy
@@ -25,10 +25,10 @@ import org.codehaus.plexus.util.*;
 
 try
 {
-    String[] expected = {
+    String[] expected = [
             "target/its/script-ret-true/target/touch.txt",
             "target/its/script-ret-quiet/target/touch.txt",
-      };
+      ];
     for ( String file : expected )
     {
         File touchFile = new File( basedir, file );
@@ -40,11 +40,11 @@ try
         }
     }
 
-    String[] unexpected = {
+    String[] unexpected = [
             "target/its/script-ret-false/target/touch.txt",
             "target/its/script-ret-other/target/touch.txt",
             "target/its/script-throws/target/touch.txt",
-      };
+      ];
     for ( String file : unexpected )
     {
         File touchFile = new File( basedir, file );
@@ -56,10 +56,10 @@ try
         }
     }
 
-    String[] success = {
+    String[] success = [
             "target/invoker-reports-test/BUILD-script-ret-true.xml",
             "target/invoker-reports-test/BUILD-script-ret-quiet.xml",
-      };
+      ];
     for ( String file : success )
     {
          File resultFile = new File( basedir, file );
@@ -72,10 +72,10 @@ try
          }
     }
 
-    String[] skipped = {
+    String[] skipped = [
             "target/invoker-reports-test/BUILD-script-ret-false.xml",
             "target/invoker-reports-test/BUILD-script-ret-other.xml",
-      };
+      ];
     for ( String file : skipped )
     {
          File resultFile = new File( basedir, file );
@@ -89,9 +89,9 @@ try
     }
 
 
-    String[] inerror = {
+    String[] inerror = [
             "target/invoker-reports-test/BUILD-script-throw.xml",
-      };
+      ];
     for ( String file : inerror )
     {
          File resultFile = new File( basedir, file );
diff --git a/src/it/staging-dependencies-test-scope/verify.groovy b/src/it/staging-dependencies-test-scope/verify.groovy
index 9b32cff..c06f51f 100644
--- a/src/it/staging-dependencies-test-scope/verify.groovy
+++ b/src/it/staging-dependencies-test-scope/verify.groovy
@@ -34,7 +34,7 @@ try
         return false;
     }
 
-    String[] files = {
+    String[] files = [
             "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar",
             "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom",
             "org/slf4j/slf4j-api/maven-metadata-local.xml",
@@ -45,7 +45,7 @@ try
             "org/slf4j/slf4j-simple/maven-metadata-local.xml",
             "test/staging-dependencies-test-scope/1.0-SNAPSHOT/staging-dependencies-test-scope-1.0-SNAPSHOT.pom",
             "test/staging-dependencies-test-scope/1.0-SNAPSHOT/staging-dependencies-test-scope-1.0-SNAPSHOT.jar"
-      };
+      ];
     for ( String file : files )
     {
         File stagedFile = new File( itRepoDir, file );
diff --git a/src/it/staging-dependencies/verify.groovy b/src/it/staging-dependencies/verify.groovy
index 5a1fb4b..d3c9f35 100644
--- a/src/it/staging-dependencies/verify.groovy
+++ b/src/it/staging-dependencies/verify.groovy
@@ -34,7 +34,7 @@ try
         return false;
     }
 
-    String[] files = {
+    String[] files = [
             "junit/junit/4.13.1/junit-4.13.1.pom",
             "junit/junit/4.13.1/junit-4.13.1.jar",
             "junit/junit/maven-metadata-local.xml",
@@ -61,7 +61,7 @@ try
             "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom",
             "org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar",
             "org/slf4j/slf4j-parent/1.7.36/slf4j-parent-1.7.36.pom"
-      };
+      ];
     for ( String file : files )
     {
         File stagedFile = new File( itRepoDir, file );
diff --git a/src/it/staging-pom/verify.groovy b/src/it/staging-pom/verify.groovy
index c49ef78..b1d033f 100644
--- a/src/it/staging-pom/verify.groovy
+++ b/src/it/staging-pom/verify.groovy
@@ -31,12 +31,12 @@ try
         return false;
     }
 
-    String[] files = {
+    String[] files = [
             "test/pom-packaging/1.0-SNAPSHOT/pom-packaging-1.0-SNAPSHOT.pom",
             "org/apache/maven/plugins/maven-plugins/39/maven-plugins-39.pom",
             "org/apache/maven/maven-parent/39/maven-parent-39.pom",
             "org/apache/apache/29/apache-29.pom"
-      };
+      ];
     for ( String file : files )
     {
         File stagedFile = new File( itRepoDir, file );
diff --git a/src/it/staging-reactor/verify.groovy b/src/it/staging-reactor/verify.groovy
index bc88213..c0cac4d 100644
--- a/src/it/staging-reactor/verify.groovy
+++ b/src/it/staging-reactor/verify.groovy
@@ -32,7 +32,7 @@ try
     }
 
     // NOTE: Checking the metadata is included to guard against regression of MINVOKER-43
-    String[] files = {
+    String[] files = [
             "test/mod1/maven-metadata-local.xml",
             "test/mod1/1.0-SNAPSHOT/maven-metadata-local.xml",
             "test/mod1/1.0-SNAPSHOT/mod1-1.0-SNAPSHOT.pom",
@@ -50,7 +50,7 @@ try
             "test/mod2-parent/maven-metadata-local.xml",
             "test/mod2-parent/1.0-SNAPSHOT/maven-metadata-local.xml",
             "test/mod2-parent/1.0-SNAPSHOT/mod2-parent-1.0-SNAPSHOT.pom",
-      };
+      ];
     for ( String file : files )
     {
         File stagedFile = new File( itRepoDir, file );