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 65013c833fbf337ea218d772eb80a10707903213
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Thu Nov 26 04:24:20 2026 +0000

    Modernize nested IT fixture scripts
    
    See #811.
---
 src/it/MINVOKER-289/src/it/project/prebuild.groovy |  2 --
 .../src/it/project/prebuild.groovy                 |  2 --
 .../invocation-project/src/it/project/setup.groovy |  9 ++----
 .../src/it/project/postbuild.groovy                | 20 +++---------
 .../src/it/project/postbuild.groovy                | 21 ++-----------
 .../src/it/groovy/postbuild.groovy                 | 23 +++-----------
 .../src/it/groovy/prebuild.groovy                  | 23 +++-----------
 .../src/it/groovy/selector.groovy                  | 21 +++----------
 .../src/it/groovy/postbuild.groovy                 | 21 +++----------
 .../src/it/groovy/prebuild.groovy                  | 21 +++----------
 src/it/script-context/src/it/groovy/setup.groovy   |  4 ---
 src/it/script-context/src/it/groovy/verify.groovy  |  4 ---
 .../script-global-vars/src/it/groovy/setup.groovy  | 36 +++++-----------------
 .../script-global-vars/src/it/groovy/verify.groovy | 36 +++++-----------------
 .../src/it/groovy/postbuild.groovy                 | 21 +++----------
 .../src/it/groovy/prebuild.groovy                  | 21 +++----------
 .../settings-merge/src/it/project/postbuild.groovy |  3 +-
 17 files changed, 56 insertions(+), 232 deletions(-)

diff --git a/src/it/MINVOKER-289/src/it/project/prebuild.groovy 
b/src/it/MINVOKER-289/src/it/project/prebuild.groovy
index 9847860..0065a2d 100644
--- a/src/it/MINVOKER-289/src/it/project/prebuild.groovy
+++ b/src/it/MINVOKER-289/src/it/project/prebuild.groovy
@@ -17,8 +17,6 @@
  * under the License.
  */
 
-import java.io.*
-
 // marker for parent build that this sub build was indeed run
 File touchFile = new File(basedir, "touch.txt")
 touchFile.createNewFile()
diff --git a/src/it/integration-test-never-fails/src/it/project/prebuild.groovy 
b/src/it/integration-test-never-fails/src/it/project/prebuild.groovy
index 9847860..0065a2d 100644
--- a/src/it/integration-test-never-fails/src/it/project/prebuild.groovy
+++ b/src/it/integration-test-never-fails/src/it/project/prebuild.groovy
@@ -17,8 +17,6 @@
  * under the License.
  */
 
-import java.io.*
-
 // marker for parent build that this sub build was indeed run
 File touchFile = new File(basedir, "touch.txt")
 touchFile.createNewFile()
diff --git a/src/it/invocation-project/src/it/project/setup.groovy 
b/src/it/invocation-project/src/it/project/setup.groovy
index 4f45430..b6c08cf 100644
--- a/src/it/invocation-project/src/it/project/setup.groovy
+++ b/src/it/invocation-project/src/it/project/setup.groovy
@@ -17,15 +17,10 @@
  * under the License.
  */
 
-import java.io.*
-
-String[] paths =
-        ["target", "sub-1/target", "sub-2/target", "sub-3/target",]
+String[] paths = ["target", "sub-1/target", "sub-2/target", "sub-3/target"]
 
 for (String path : paths) {
     File dir = new File(basedir, path)
     System.out.println("Creating directory: " + dir)
-    if (!dir.mkdirs()) {
-        throw new IOException("Failed to create directory: " + dir)
-    }
+    assert dir.mkdirs() : "Failed to create directory: " + dir
 }
diff --git a/src/it/local-repo-default/src/it/project/postbuild.groovy 
b/src/it/local-repo-default/src/it/project/postbuild.groovy
index 2387276..81c5e1b 100644
--- a/src/it/local-repo-default/src/it/project/postbuild.groovy
+++ b/src/it/local-repo-default/src/it/project/postbuild.groovy
@@ -17,21 +17,9 @@
  * under the License.
  */
 
-import java.io.*
-import java.util.*
-import java.util.regex.*
-
-try {
-    // just dump our local repo path for verification by the parent build
-    File textFile = new File(basedir, "target/local-repo-path.txt")
-    textFile.getParentFile().mkdirs()
-    Writer writer = new OutputStreamWriter(new FileOutputStream(textFile), 
"UTF-8")
-    writer.write(localRepositoryPath.getAbsolutePath())
-    writer.close()
-}
-catch(Throwable t) {
-    t.printStackTrace()
-    return false
-}
+// just dump our local repo path for verification by the parent build
+File textFile = new File(basedir, "target/local-repo-path.txt")
+textFile.getParentFile().mkdirs()
+textFile.write(localRepositoryPath.getAbsolutePath(), 'UTF-8')
 
 return true
diff --git 
a/src/it/postbuild-executed-only-once/src/it/project/postbuild.groovy 
b/src/it/postbuild-executed-only-once/src/it/project/postbuild.groovy
index 6070d27..83006f7 100644
--- a/src/it/postbuild-executed-only-once/src/it/project/postbuild.groovy
+++ b/src/it/postbuild-executed-only-once/src/it/project/postbuild.groovy
@@ -17,21 +17,6 @@
  * under the License.
  */
 
-import java.io.*
-import java.util.*
-import java.util.regex.*
-
-try {
-    File touchFile = new File(basedir, "target/touch.txt")
-    System.out.println("Checking for existence of touch file: " + touchFile)
-    if (!touchFile.exists()) {
-        System.out.println("touch.txt not exists FAILED!")
-        return false
-    }
-}
-catch(Throwable t) {
-    t.printStackTrace()
-    return false
-}
-
-return true
+File touchFile = new File(basedir, "target/touch.txt")
+System.out.println("Checking for existence of touch file: " + touchFile)
+assert touchFile.exists() : "touch.txt not exists FAILED!"
diff --git a/src/it/script-additional-vars/src/it/groovy/postbuild.groovy 
b/src/it/script-additional-vars/src/it/groovy/postbuild.groovy
index 61ae095..a3639e5 100644
--- a/src/it/script-additional-vars/src/it/groovy/postbuild.groovy
+++ b/src/it/script-additional-vars/src/it/groovy/postbuild.groovy
@@ -17,23 +17,8 @@
  * under the License.
  */
 
-import java.io.*
-import java.util.*
+println hello
+assert hello == "world" : "Additional script variable declared in mojo 
configuration not defined: hello"
 
-try {
-    println hello
-    if (!hello.equals("world")) {
-        println "Additional script variable declared in mojo configuration not 
defined: hello"
-        return false
-    }
-
-    println version
-    if (!version.equals("1.0-SNAPSHOT")) {
-        println "Additional script variable declared in mojo configuration not 
defined: version"
-        return false
-    }
-}
-catch(Throwable t) {
-    t.printStackTrace()
-    return false
-}
+println version
+assert version == "1.0-SNAPSHOT" : "Additional script variable declared in 
mojo configuration not defined: version"
diff --git a/src/it/script-additional-vars/src/it/groovy/prebuild.groovy 
b/src/it/script-additional-vars/src/it/groovy/prebuild.groovy
index 61ae095..a3639e5 100644
--- a/src/it/script-additional-vars/src/it/groovy/prebuild.groovy
+++ b/src/it/script-additional-vars/src/it/groovy/prebuild.groovy
@@ -17,23 +17,8 @@
  * under the License.
  */
 
-import java.io.*
-import java.util.*
+println hello
+assert hello == "world" : "Additional script variable declared in mojo 
configuration not defined: hello"
 
-try {
-    println hello
-    if (!hello.equals("world")) {
-        println "Additional script variable declared in mojo configuration not 
defined: hello"
-        return false
-    }
-
-    println version
-    if (!version.equals("1.0-SNAPSHOT")) {
-        println "Additional script variable declared in mojo configuration not 
defined: version"
-        return false
-    }
-}
-catch(Throwable t) {
-    t.printStackTrace()
-    return false
-}
+println version
+assert version == "1.0-SNAPSHOT" : "Additional script variable declared in 
mojo configuration not defined: version"
diff --git a/src/it/script-additional-vars/src/it/groovy/selector.groovy 
b/src/it/script-additional-vars/src/it/groovy/selector.groovy
index 794f818..a3639e5 100644
--- a/src/it/script-additional-vars/src/it/groovy/selector.groovy
+++ b/src/it/script-additional-vars/src/it/groovy/selector.groovy
@@ -17,21 +17,8 @@
  * under the License.
  */
 
-import java.io.*
-import java.util.*
+println hello
+assert hello == "world" : "Additional script variable declared in mojo 
configuration not defined: hello"
 
-try {
-    println hello
-    if (!hello.equals("world")) {
-        throw new Exception("Additional script variable declared in mojo 
configuration not defined: hello")
-    }
-
-    println version
-    if (!version.equals("1.0-SNAPSHOT")) {
-        throw new Exception("Additional script variable declared in mojo 
configuration not defined: version")
-    }
-}
-catch(Throwable t) {
-    t.printStackTrace()
-    throw t
-}
+println version
+assert version == "1.0-SNAPSHOT" : "Additional script variable declared in 
mojo configuration not defined: version"
diff --git a/src/it/script-classpath-duplicates/src/it/groovy/postbuild.groovy 
b/src/it/script-classpath-duplicates/src/it/groovy/postbuild.groovy
index 584667a..c8b309f 100644
--- a/src/it/script-classpath-duplicates/src/it/groovy/postbuild.groovy
+++ b/src/it/script-classpath-duplicates/src/it/groovy/postbuild.groovy
@@ -17,21 +17,10 @@
  * under the License.
  */
 
-import java.io.*
-import java.lang.reflect.*
-import java.util.*
-import java.util.regex.*
-
-try {
-    // create touch file so that the parent build can verify whether this 
script was called
-    File touchFile = new File(basedir, "target/created-by-postbuild.groovy")
-    println "Creating touch file: " + touchFile
-    touchFile.getParentFile().mkdirs()
-    touchFile.createNewFile()
-}
-catch(Throwable t) {
-    t.printStackTrace()
-    return false
-}
+// create touch file so that the parent build can verify whether this script 
was called
+File touchFile = new File(basedir, "target/created-by-postbuild.groovy")
+println "Creating touch file: " + touchFile
+touchFile.getParentFile().mkdirs()
+touchFile.createNewFile()
 
 return true
diff --git a/src/it/script-classpath-duplicates/src/it/groovy/prebuild.groovy 
b/src/it/script-classpath-duplicates/src/it/groovy/prebuild.groovy
index 18c3f8c..3d8d000 100644
--- a/src/it/script-classpath-duplicates/src/it/groovy/prebuild.groovy
+++ b/src/it/script-classpath-duplicates/src/it/groovy/prebuild.groovy
@@ -17,21 +17,10 @@
  * under the License.
  */
 
-import java.io.*
-import java.lang.reflect.*
-import java.util.*
-import java.util.regex.*
-
-try {
-    // create touch file so that the parent build can verify whether this 
script was called
-    File touchFile = new File(basedir, "target/created-by-prebuild.groovy")
-    println "Creating touch file: " + touchFile
-    touchFile.getParentFile().mkdirs()
-    touchFile.createNewFile()
-}
-catch(Throwable t) {
-    t.printStackTrace()
-    return false
-}
+// create touch file so that the parent build can verify whether this script 
was called
+File touchFile = new File(basedir, "target/created-by-prebuild.groovy")
+println "Creating touch file: " + touchFile
+touchFile.getParentFile().mkdirs()
+touchFile.createNewFile()
 
 return true
diff --git a/src/it/script-context/src/it/groovy/setup.groovy 
b/src/it/script-context/src/it/groovy/setup.groovy
index dac9ed9..e974e48 100644
--- a/src/it/script-context/src/it/groovy/setup.groovy
+++ b/src/it/script-context/src/it/groovy/setup.groovy
@@ -17,10 +17,6 @@
  * under the License.
  */
 
-import java.io.*
-import java.util.*
-import java.util.regex.*
-
 context.put("touchFile", new File(basedir, "touch.txt"))
 
 println context
diff --git a/src/it/script-context/src/it/groovy/verify.groovy 
b/src/it/script-context/src/it/groovy/verify.groovy
index 311b3d8..4719a05 100644
--- a/src/it/script-context/src/it/groovy/verify.groovy
+++ b/src/it/script-context/src/it/groovy/verify.groovy
@@ -17,10 +17,6 @@
  * under the License.
  */
 
-import java.io.*
-import java.util.*
-import java.util.regex.*
-
 println context
 
 File touchFile = context.get("touchFile")
diff --git a/src/it/script-global-vars/src/it/groovy/setup.groovy 
b/src/it/script-global-vars/src/it/groovy/setup.groovy
index f8f5590..0a4c296 100644
--- a/src/it/script-global-vars/src/it/groovy/setup.groovy
+++ b/src/it/script-global-vars/src/it/groovy/setup.groovy
@@ -17,34 +17,12 @@
  * under the License.
  */
 
-import java.io.*
-import java.util.*
-import java.util.regex.*
+println basedir
+assert basedir instanceof File : "Global script variable not defined: basedir"
 
-try {
-    println basedir
-    if (!(basedir instanceof File)) {
-        println "Global script variable not defined: basedir"
-        return false
-    }
+println localRepositoryPath
+assert localRepositoryPath instanceof File : "Global script variable not 
defined: localRepositoryPath"
 
-    println localRepositoryPath
-    if (!(localRepositoryPath instanceof File)) {
-        println "Global script variable not defined: localRepositoryPath"
-        return false
-    }
-
-    println mavenVersion
-    if (!mavenVersion) {
-        println "Global script variable not defined: mavenVersion"
-        return false
-    }
-    if (!mavenVersion?.trim()) {
-        println "Global script variable empty: mavenVersion"
-        return false
-    }
-}
-catch(Throwable t) {
-    t.printStackTrace()
-    return false
-}
+println mavenVersion
+assert mavenVersion : "Global script variable not defined: mavenVersion"
+assert mavenVersion.trim() : "Global script variable empty: mavenVersion"
diff --git a/src/it/script-global-vars/src/it/groovy/verify.groovy 
b/src/it/script-global-vars/src/it/groovy/verify.groovy
index f8f5590..0a4c296 100644
--- a/src/it/script-global-vars/src/it/groovy/verify.groovy
+++ b/src/it/script-global-vars/src/it/groovy/verify.groovy
@@ -17,34 +17,12 @@
  * under the License.
  */
 
-import java.io.*
-import java.util.*
-import java.util.regex.*
+println basedir
+assert basedir instanceof File : "Global script variable not defined: basedir"
 
-try {
-    println basedir
-    if (!(basedir instanceof File)) {
-        println "Global script variable not defined: basedir"
-        return false
-    }
+println localRepositoryPath
+assert localRepositoryPath instanceof File : "Global script variable not 
defined: localRepositoryPath"
 
-    println localRepositoryPath
-    if (!(localRepositoryPath instanceof File)) {
-        println "Global script variable not defined: localRepositoryPath"
-        return false
-    }
-
-    println mavenVersion
-    if (!mavenVersion) {
-        println "Global script variable not defined: mavenVersion"
-        return false
-    }
-    if (!mavenVersion?.trim()) {
-        println "Global script variable empty: mavenVersion"
-        return false
-    }
-}
-catch(Throwable t) {
-    t.printStackTrace()
-    return false
-}
+println mavenVersion
+assert mavenVersion : "Global script variable not defined: mavenVersion"
+assert mavenVersion.trim() : "Global script variable empty: mavenVersion"
diff --git a/src/it/script-interpreter-detection/src/it/groovy/postbuild.groovy 
b/src/it/script-interpreter-detection/src/it/groovy/postbuild.groovy
index a50a859..f069d4b 100644
--- a/src/it/script-interpreter-detection/src/it/groovy/postbuild.groovy
+++ b/src/it/script-interpreter-detection/src/it/groovy/postbuild.groovy
@@ -17,21 +17,10 @@
  * under the License.
  */
 
-import java.io.*
-import java.lang.reflect.*
-import java.util.*
-import java.util.regex.*
-
-try {
-    // create touch file so that the parent build can verify whether this 
script was called
-    File touchFile = new File(basedir, "target/postbuild.groovy")
-    println "Creating touch file: " + touchFile
-    touchFile.getParentFile().mkdirs()
-    touchFile.createNewFile()
-}
-catch(Throwable t) {
-    t.printStackTrace()
-    return false
-}
+// create touch file so that the parent build can verify whether this script 
was called
+File touchFile = new File(basedir, "target/postbuild.groovy")
+println "Creating touch file: " + touchFile
+touchFile.getParentFile().mkdirs()
+touchFile.createNewFile()
 
 return true
diff --git a/src/it/script-interpreter-detection/src/it/groovy/prebuild.groovy 
b/src/it/script-interpreter-detection/src/it/groovy/prebuild.groovy
index 0376671..fb5e21d 100644
--- a/src/it/script-interpreter-detection/src/it/groovy/prebuild.groovy
+++ b/src/it/script-interpreter-detection/src/it/groovy/prebuild.groovy
@@ -17,21 +17,10 @@
  * under the License.
  */
 
-import java.io.*
-import java.lang.reflect.*
-import java.util.*
-import java.util.regex.*
-
-try {
-    // create touch file so that the parent build can verify whether this 
script was called
-    File touchFile = new File(basedir, "target/prebuild.groovy")
-    println "Creating touch file: " + touchFile
-    touchFile.getParentFile().mkdirs()
-    touchFile.createNewFile()
-}
-catch(Throwable t) {
-    t.printStackTrace()
-    return false
-}
+// create touch file so that the parent build can verify whether this script 
was called
+File touchFile = new File(basedir, "target/prebuild.groovy")
+println "Creating touch file: " + touchFile
+touchFile.getParentFile().mkdirs()
+touchFile.createNewFile()
 
 return true
diff --git a/src/it/settings-merge/src/it/project/postbuild.groovy 
b/src/it/settings-merge/src/it/project/postbuild.groovy
index 17d1ad9..3cb0e47 100644
--- a/src/it/settings-merge/src/it/project/postbuild.groovy
+++ b/src/it/settings-merge/src/it/project/postbuild.groovy
@@ -27,5 +27,4 @@ def server = settings.servers.server.find{
     it.id.equals('dummy-it-settings-merge')
 }
 
-if(!server.password.equals('overridden'))
-    throw new org.apache.maven.plugin.MojoExecutionException("Incorrect server 
password - specified settings.xml not merged/dominant " + server.password)
+assert server.password.equals('overridden') : "Incorrect server password - 
specified settings.xml not merged/dominant " + server.password

Reply via email to