You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2019/01/18 19:52:34 UTC

[maven-jmod-plugin] branch refactor created (now 093c943)

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

rfscholte pushed a change to branch refactor
in repository https://gitbox.apache.org/repos/asf/maven-jmod-plugin.git.


      at 093c943  Groovify verify scripts

This branch includes the following new commits:

     new 093c943  Groovify verify scripts

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-jmod-plugin] 01/01: Groovify verify scripts

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 093c9431aa407e764735b4613ce36da0588c6bb6
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jan 18 20:52:24 2019 +0100

    Groovify verify scripts
---
 src/it/base-config-cmds/verify.groovy              | 70 ++++++-------------
 src/it/base-config-headerfiles/verify.groovy       | 72 ++++++-------------
 src/it/base-config-legalnotices/verify.groovy      | 68 +++++-------------
 src/it/base-config-libs/verify.groovy              | 68 +++++-------------
 src/it/base-config/verify.groovy                   | 68 +++++-------------
 src/it/base-it/verify.groovy                       | 65 +++++-------------
 src/it/describe-base-config/verify.groovy          | 78 ++++-----------------
 src/it/describe-plain/verify.groovy                | 79 ++++-----------------
 src/it/list-base-config/verify.groovy              | 80 ++++------------------
 src/it/list-plain/verify.groovy                    | 80 ++++------------------
 src/it/mjmod-20-set-main-class/verify.groovy       |  6 +-
 .../verify.groovy                                  |  6 +-
 src/it/non-default-config-cmds/verify.groovy       | 70 ++++++-------------
 .../non-default-config-headerfiles/verify.groovy   | 72 ++++++-------------
 .../non-default-config-legalnotices/verify.groovy  | 68 +++++-------------
 src/it/non-default-config-libs/verify.groovy       | 68 +++++-------------
 src/it/non-default-config/verify.groovy            | 71 ++++++-------------
 17 files changed, 272 insertions(+), 817 deletions(-)

diff --git a/src/it/base-config-cmds/verify.groovy b/src/it/base-config-cmds/verify.groovy
index 0afcfc2..3c38036 100644
--- a/src/it/base-config-cmds/verify.groovy
+++ b/src/it/base-config-cmds/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,60 +17,31 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
+import java.util.jar.*
 
-    File artifact = new File( target, "jmods/maven-jmod-plugin-base-config-cmds.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "target file is missing or a directory." );
-        return false;
-    }
+def target = new File( basedir, 'target' )
+assert ( target.exists() && target.isDirectory() ) : 'target file is missing or not a directory.'
 
-    String[] artifactNames = [
-        "bin/first.sh",
-        "conf/config.test",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
+def artifact = new File( target, 'jmods/maven-jmod-plugin-base-config-cmds.jmod' )
+assert ( artifact.exists() && artifact.isFile() ) : 'target file is missing or a directory.'
 
-    Set contents = new HashSet();
+def resourceNames = [
+    'bin/first.sh',
+    'conf/config.test',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
+def contents = [] as Set
 
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
+def jar = new JarFile( artifact )
+def jarEntries = jar.entries()
+while ( jarEntries.hasMoreElements() ) {
+    def entry = (JarEntry) jarEntries.nextElement()
+    if ( !entry.isDirectory() ) {
+        // Only compare files
+        contents.add( entry.getName() )
     }
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
 }
 
-return result;
+assert resourceNames == contents
\ No newline at end of file
diff --git a/src/it/base-config-headerfiles/verify.groovy b/src/it/base-config-headerfiles/verify.groovy
index 4f8ae6e..0ee9554 100644
--- a/src/it/base-config-headerfiles/verify.groovy
+++ b/src/it/base-config-headerfiles/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,61 +17,32 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
+import java.util.jar.*
 
-    File artifact = new File( target, "jmods/maven-jmod-plugin-base-config-headerfiles.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "target file is missing or a directory." );
-        return false;
-    }
+def target = new File( basedir, 'target' )
+assert ( target.exists() && target.isDirectory() ) : 'target file is missing or not a directory.'
 
-    String[] artifactNames = [
-        "include/first.h",
-        "bin/first.sh",
-        "conf/config.test",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
+def artifact = new File( target, 'jmods/maven-jmod-plugin-base-config-headerfiles.jmod' )
+assert ( artifact.exists() && artifact.isFile() ) : 'target file is missing or a directory.'
 
-    Set contents = new HashSet();
+def resourceNames = [
+    'include/first.h',
+    'bin/first.sh',
+    'conf/config.test',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
+def contents = [] as Set
 
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
+def jar = new JarFile( artifact )
+def jarEntries = jar.entries()
+while ( jarEntries.hasMoreElements() ) {
+    def entry = (JarEntry) jarEntries.nextElement()
+    if ( !entry.isDirectory() ) {
+        // Only compare files
+        contents.add( entry.getName() )
     }
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
 }
 
-return result;
+assert resourceNames == contents
diff --git a/src/it/base-config-legalnotices/verify.groovy b/src/it/base-config-legalnotices/verify.groovy
index c9a88f6..d6b1a01 100644
--- a/src/it/base-config-legalnotices/verify.groovy
+++ b/src/it/base-config-legalnotices/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,59 +17,30 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
+import java.util.jar.*
 
-    File artifact = new File( target, "jmods/maven-jmod-plugin-base-config-legalnotices.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "target file is missing or a directory." );
-        return false;
-    }
+def target = new File( basedir, 'target' )
+assert ( target.exists() && target.isDirectory() ) : 'target file is missing or not a directory.'
 
-    String[] artifactNames = [
-        "legal/first.md",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
+def artifact = new File( target, 'jmods/maven-jmod-plugin-base-config-legalnotices.jmod' )
+assert ( artifact.exists() && artifact.isFile() ) : 'target file is missing or a directory.'
 
-    Set contents = new HashSet();
+def resourceNames = [
+    'legal/first.md',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
+def contents = [] as Set
 
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
+def jar = new JarFile( artifact )
+def jarEntries = jar.entries()
+while ( jarEntries.hasMoreElements() ) {
+    def entry = (JarEntry) jarEntries.nextElement()
+    if ( !entry.isDirectory() ) {
+        // Only compare files
+        contents.add( entry.getName() )
     }
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
 }
 
-return result;
+assert resourceNames == contents
diff --git a/src/it/base-config-libs/verify.groovy b/src/it/base-config-libs/verify.groovy
index 7ad324a..b4a4b2c 100644
--- a/src/it/base-config-libs/verify.groovy
+++ b/src/it/base-config-libs/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,59 +17,30 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
+import java.util.jar.*
 
-    File artifact = new File( target, "jmods/maven-jmod-plugin-base-config-libs.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "target file is missing or a directory." );
-        return false;
-    }
+def target = new File( basedir, 'target' )
+assert ( target.exists() && target.isDirectory() ) : 'target file is missing or not a directory.'
 
-    String[] artifactNames = [
-        "lib/first.so",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
+def artifact = new File( target, 'jmods/maven-jmod-plugin-base-config-libs.jmod' )
+assert ( artifact.exists() && artifact.isFile() ) : 'target file is missing or a directory.'
 
-    Set contents = new HashSet();
+def resourceNames = [
+    'lib/first.so',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
+def contents = [] as Set
 
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
+def jar = new JarFile( artifact )
+def jarEntries = jar.entries()
+while ( jarEntries.hasMoreElements() ) {
+    def entry = (JarEntry) jarEntries.nextElement()
+    if ( !entry.isDirectory() ) {
+        // Only compare files
+        contents.add( entry.getName() )
     }
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
 }
 
-return result;
+assert resourceNames == contents
diff --git a/src/it/base-config/verify.groovy b/src/it/base-config/verify.groovy
index 705d500..55859ca 100644
--- a/src/it/base-config/verify.groovy
+++ b/src/it/base-config/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,59 +17,30 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
+import java.util.jar.*
 
-    File artifact = new File( target, "jmods/maven-jmod-plugin-base-config.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "target file is missing or a directory." );
-        return false;
-    }
+def target = new File( basedir, 'target' )
+assert ( target.exists() && target.isDirectory() ) : 'target file is missing or not a directory.'
 
-    String[] artifactNames = [
-        "conf/config.test",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
+def artifact = new File( target, 'jmods/maven-jmod-plugin-base-config.jmod' )
+assert ( artifact.exists() && artifact.isFile() ) : 'target file is missing or a directory.'
 
-    Set contents = new HashSet();
+def resourceNames = [
+    'conf/config.test',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
+def contents = [] as Set
 
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
+def jar = new JarFile( artifact )
+def jarEntries = jar.entries()
+while ( jarEntries.hasMoreElements() ) {
+    def entry = (JarEntry) jarEntries.nextElement()
+    if ( !entry.isDirectory() ) {
+        // Only compare files
+        contents.add( entry.getName() )
     }
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
 }
 
-return result;
+assert resourceNames == contents
diff --git a/src/it/base-it/verify.groovy b/src/it/base-it/verify.groovy
index 44159f3..f822434 100644
--- a/src/it/base-it/verify.groovy
+++ b/src/it/base-it/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,58 +17,30 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
+import java.util.jar.*
 
-boolean result = true;
+def target = new File( basedir, 'target' )
+assert ( target.exists() && target.isDirectory() ) : 'target file is missing or not a directory.'
 
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
+def artifact = new File( target, 'jmods/maven-jmod-plugin-base-it.jmod' )
+assert ( artifact.exists() && artifact.isFile() ) : 'target file is missing or a directory.'
 
-    File artifact = new File( target, "jmods/maven-jmod-plugin-base-it.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "target file is missing or a directory." );
-        return false;
-    }
+def resourceNames = [
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    String[] artifactNames = [
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
 
-    Set contents = new HashSet();
+def contents = [] as Set
 
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
+def jar = new JarFile( artifact )
+def jarEntries = jar.entries()
+while ( jarEntries.hasMoreElements() ) {
+    def entry = (JarEntry) jarEntries.nextElement()
+    if ( !entry.isDirectory() ) {
+        // Only compare files
+        contents.add( entry.getName() )
     }
-
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
-    }
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
 }
 
-return result;
+assert resourceNames == contents
diff --git a/src/it/describe-base-config/verify.groovy b/src/it/describe-base-config/verify.groovy
index 8b4f54b..cb61e39 100644
--- a/src/it/describe-base-config/verify.groovy
+++ b/src/it/describe-base-config/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,72 +17,19 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target directory is missing or not a directory." );
-        return false;
-    }
-
-    File artifact = new File( target, "jmods/maven-jmod-plugin-describe-base-config.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "the resulting jmod file is missing or a directory." );
-        return false;
-    }
-
-    String[] artifactNames = [
-        "conf/config.test",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
-
-    Set contents = new HashSet();
-
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
-
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
-    }
+def expectedDescriptorLines = [
+  'org.apache.maven.plugins.jmod.it.first@99.0',
+  'exports myproject',
+  'requires java.base'
+] as Set
 
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
+def buildLog = new File (basedir, 'build.log')
 
-    def buildLog = new File (basedir, "build.log")
+def describeLines = buildLog.readLines()
+                            .dropWhile{ it != '[INFO] org.apache.maven.plugins.jmod.it.first@99.0' } 
+                            .takeWhile{ !it.startsWith('[INFO] ---') }
+                            .grep()
+                            .collect{ it - '[INFO] ' } as Set
 
-    if (!buildLog.text.contains("[INFO] org.apache.maven.plugins.jmod.it.first@99.0")) {
-        return false;
-    }
-    if (!buildLog.text.contains("[INFO] exports myproject")) {
-        return false;
-    }
-    if (!buildLog.text.contains("[INFO] requires java.base")) {
-        return false;
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
-}
+assert expectedDescriptorLines == describeLines
 
-return result;
diff --git a/src/it/describe-plain/verify.groovy b/src/it/describe-plain/verify.groovy
index 8b4f54b..9050b36 100644
--- a/src/it/describe-plain/verify.groovy
+++ b/src/it/describe-plain/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,72 +17,18 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target directory is missing or not a directory." );
-        return false;
-    }
-
-    File artifact = new File( target, "jmods/maven-jmod-plugin-describe-base-config.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "the resulting jmod file is missing or a directory." );
-        return false;
-    }
-
-    String[] artifactNames = [
-        "conf/config.test",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
-
-    Set contents = new HashSet();
-
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
-
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
-    }
-
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
+def expectedDescriptorLines = [
+  'org.apache.maven.plugins.jmod.it.first@99.0',
+  'exports myproject',
+  'requires java.base'
+] as Set
 
-    def buildLog = new File (basedir, "build.log")
+def buildLog = new File (basedir, 'build.log')
 
-    if (!buildLog.text.contains("[INFO] org.apache.maven.plugins.jmod.it.first@99.0")) {
-        return false;
-    }
-    if (!buildLog.text.contains("[INFO] exports myproject")) {
-        return false;
-    }
-    if (!buildLog.text.contains("[INFO] requires java.base")) {
-        return false;
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
-}
+def describeLines = buildLog.readLines()
+                            .dropWhile{ it != '[INFO] org.apache.maven.plugins.jmod.it.first@99.0' } 
+                            .takeWhile{ !it.startsWith('[INFO] ---') }
+                            .grep()
+                            .collect{ it - '[INFO] ' } as Set
 
-return result;
+assert expectedDescriptorLines == describeLines
diff --git a/src/it/list-base-config/verify.groovy b/src/it/list-base-config/verify.groovy
index d3f9c0d..a854396 100644
--- a/src/it/list-base-config/verify.groovy
+++ b/src/it/list-base-config/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,72 +17,19 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target directory is missing or not a directory." );
-        return false;
-    }
-
-    File artifact = new File( target, "jmods/maven-jmod-plugin-list-base-config.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "the resulting jmod file is missing or a directory." );
-        return false;
-    }
-
-    String[] artifactNames = [
-        "conf/config.test",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
-
-    Set contents = new HashSet();
-
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
-
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
-    }
-
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
+def resourceNames = [
+    'conf/config.test',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    def buildLog = new File (basedir, "build.log")
+def buildLog = new File (basedir, 'build.log')
 
-    if (!buildLog.text.contains("[INFO] classes/module-info.class")) {
-        return false;
-    }
-    if (!buildLog.text.contains("[INFO] classes/myproject/HelloWorld.class")) {
-        return false;
-    }
-    if (!buildLog.text.contains("[INFO] conf/config.test")) {
-        return false;
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
-}
+def listLines = buildLog.readLines()
+                            .dropWhile{ !it.startsWith('[INFO] The following files are contained in the module file') }
+                            .drop(1)
+                            .takeWhile{ !it.startsWith('[INFO] ---') }
+                            .findAll{ it.startsWith('[INFO] ')}
+                            .collect{ it - '[INFO] ' } as Set
 
-return result;
+assert listLines == resourceNames
diff --git a/src/it/list-plain/verify.groovy b/src/it/list-plain/verify.groovy
index d3f9c0d..a854396 100644
--- a/src/it/list-plain/verify.groovy
+++ b/src/it/list-plain/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,72 +17,19 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target directory is missing or not a directory." );
-        return false;
-    }
-
-    File artifact = new File( target, "jmods/maven-jmod-plugin-list-base-config.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "the resulting jmod file is missing or a directory." );
-        return false;
-    }
-
-    String[] artifactNames = [
-        "conf/config.test",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
-
-    Set contents = new HashSet();
-
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
-
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
-    }
-
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
+def resourceNames = [
+    'conf/config.test',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    def buildLog = new File (basedir, "build.log")
+def buildLog = new File (basedir, 'build.log')
 
-    if (!buildLog.text.contains("[INFO] classes/module-info.class")) {
-        return false;
-    }
-    if (!buildLog.text.contains("[INFO] classes/myproject/HelloWorld.class")) {
-        return false;
-    }
-    if (!buildLog.text.contains("[INFO] conf/config.test")) {
-        return false;
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
-}
+def listLines = buildLog.readLines()
+                            .dropWhile{ !it.startsWith('[INFO] The following files are contained in the module file') }
+                            .drop(1)
+                            .takeWhile{ !it.startsWith('[INFO] ---') }
+                            .findAll{ it.startsWith('[INFO] ')}
+                            .collect{ it - '[INFO] ' } as Set
 
-return result;
+assert listLines == resourceNames
diff --git a/src/it/mjmod-20-set-main-class/verify.groovy b/src/it/mjmod-20-set-main-class/verify.groovy
index 62d0712..2e4af4e 100644
--- a/src/it/mjmod-20-set-main-class/verify.groovy
+++ b/src/it/mjmod-20-set-main-class/verify.groovy
@@ -40,7 +40,7 @@ def expectedLines = [
 
 assert describeLines == expectedLines
 
-def validateArtifact(module, artifactNames)
+def validateArtifact(module, resourceNames)
 {
     println( "Checking if ${basedir}/${module}/target exists." )
     def targetDir = new File( basedir, "/${module}/target" )
@@ -64,9 +64,9 @@ def validateArtifact(module, artifactNames)
         }
     }
 
-    assert artifactNames.size() == contents.size()
+    assert resourceNames.size() == contents.size()
 
-    artifactNames.each{ artifactName ->
+    resourceNames.each{ artifactName ->
         assert contents.contains( artifactName )
     }
 }
diff --git a/src/it/mjmod-8-generate-jmod-in-other-project/verify.groovy b/src/it/mjmod-8-generate-jmod-in-other-project/verify.groovy
index 7ca4e3d..eda2a6d 100644
--- a/src/it/mjmod-8-generate-jmod-in-other-project/verify.groovy
+++ b/src/it/mjmod-8-generate-jmod-in-other-project/verify.groovy
@@ -28,7 +28,7 @@ assert target.isDirectory()
 File artifact = new File( basedir, "/about-cli-distribution-jmod/target/jmods/about-cli-distribution-jmod.jmod" )
 assert artifact.isFile()
 
-String[] artifactNames = [
+String[] resourceNames = [
         "classes/module-info.class",
         "classes/META-INF/MANIFEST.MF",
         "classes/mymodule/about/cli/Main.class",
@@ -54,9 +54,9 @@ while ( jarEntries.hasMoreElements() )
 }
 
 println( "Comparing the expected number of files with the actual number of files" )
-assert artifactNames.length == contents.size()
+assert resourceNames.length == contents.size()
 
-artifactNames.each{ artifactName ->
+resourceNames.each{ artifactName ->
     println( "Does ${artifactName} exist in content." )
     assert contents.contains( artifactName )
 }
diff --git a/src/it/non-default-config-cmds/verify.groovy b/src/it/non-default-config-cmds/verify.groovy
index 39da642..4f3ef6d 100644
--- a/src/it/non-default-config-cmds/verify.groovy
+++ b/src/it/non-default-config-cmds/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,60 +17,31 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
+import java.util.jar.*
 
-    File artifact = new File( target, "jmods/maven-jmod-plugin-non-default-config-cmds.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "target file is missing or a directory." );
-        return false;
-    }
+def target = new File( basedir, 'target' )
+assert ( target.exists() && target.isDirectory() ) : 'target file is missing or not a directory.'
 
-    String[] artifactNames = [
-        "bin/non-default-first.sh",
-        "bin/non-default-sub-first.sh",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
+def artifact = new File( target, 'jmods/maven-jmod-plugin-non-default-config-cmds.jmod' )
+assert ( artifact.exists() && artifact.isFile() ) : 'target file is missing or a directory.'
 
-    Set contents = new HashSet();
+def resourceNames = [
+    'bin/non-default-first.sh',
+    'bin/non-default-sub-first.sh',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
+def contents = [] as Set
 
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
+def jar = new JarFile( artifact )
+def jarEntries = jar.entries()
+while ( jarEntries.hasMoreElements() ) {
+    def entry = (JarEntry) jarEntries.nextElement()
+    if ( !entry.isDirectory() ) {
+        // Only compare files
+        contents.add( entry.getName() )
     }
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
 }
 
-return result;
+assert resourceNames == contents
diff --git a/src/it/non-default-config-headerfiles/verify.groovy b/src/it/non-default-config-headerfiles/verify.groovy
index b421925..3c6f276 100644
--- a/src/it/non-default-config-headerfiles/verify.groovy
+++ b/src/it/non-default-config-headerfiles/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,61 +17,32 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
+import java.util.jar.*
 
-    File artifact = new File( target, "jmods/maven-jmod-plugin-non-default-config-headerfiles.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "target file is missing or a directory." );
-        return false;
-    }
+def target = new File( basedir, 'target' )
+assert ( target.exists() && target.isDirectory() ) : 'target file is missing or not a directory.'
 
-    String[] artifactNames = [
-        "include/non-first.h",
-        "bin/first.sh",
-        "conf/config.test",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
+def artifact = new File( target, 'jmods/maven-jmod-plugin-non-default-config-headerfiles.jmod' )
+assert ( artifact.exists() && artifact.isFile() ) : 'target file is missing or a directory.'
 
-    Set contents = new HashSet();
+def resourceNames = [
+    'include/non-first.h',
+    'bin/first.sh',
+    'conf/config.test',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
+def contents = [] as Set
 
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
+def jar = new JarFile( artifact )
+def jarEntries = jar.entries()
+while ( jarEntries.hasMoreElements() ) {
+    def entry = (JarEntry) jarEntries.nextElement()
+    if ( !entry.isDirectory() ) {
+        // Only compare files
+        contents.add( entry.getName() )
     }
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
 }
 
-return result;
+assert resourceNames == contents
diff --git a/src/it/non-default-config-legalnotices/verify.groovy b/src/it/non-default-config-legalnotices/verify.groovy
index aa3590f..f2e3f70 100644
--- a/src/it/non-default-config-legalnotices/verify.groovy
+++ b/src/it/non-default-config-legalnotices/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,59 +17,30 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
+import java.util.jar.*
 
-    File artifact = new File( target, "jmods/maven-jmod-plugin-non-default-config-legalnotices.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "target file is missing or a directory." );
-        return false;
-    }
+def target = new File( basedir, 'target' )
+assert ( target.exists() && target.isDirectory() ) : 'target file is missing or not a directory.'
 
-    String[] artifactNames = [
-        "legal/non-first.md",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
+def artifact = new File( target, 'jmods/maven-jmod-plugin-non-default-config-legalnotices.jmod' )
+assert ( artifact.exists() && artifact.isFile() ) : 'target file is missing or a directory.'
 
-    Set contents = new HashSet();
+def resourceNames = [
+    'legal/non-first.md',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
+def contents = [] as Set
 
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
+def jar = new JarFile( artifact )
+def jarEntries = jar.entries()
+while ( jarEntries.hasMoreElements() ) {
+    def entry = (JarEntry) jarEntries.nextElement()
+    if ( !entry.isDirectory() ) {
+        // Only compare files
+        contents.add( entry.getName() )
     }
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
 }
 
-return result;
+assert resourceNames == contents
diff --git a/src/it/non-default-config-libs/verify.groovy b/src/it/non-default-config-libs/verify.groovy
index 1d1fc99..4e064a5 100644
--- a/src/it/non-default-config-libs/verify.groovy
+++ b/src/it/non-default-config-libs/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,59 +17,30 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
+import java.util.jar.*
 
-    File artifact = new File( target, "jmods/maven-jmod-plugin-non-default-config-libs.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "target file is missing or a directory." );
-        return false;
-    }
+def target = new File( basedir, 'target' )
+assert ( target.exists() && target.isDirectory() ) : 'target file is missing or not a directory.'
 
-    String[] artifactNames = [
-        "lib/non-first.so",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
+def artifact = new File( target, 'jmods/maven-jmod-plugin-non-default-config-libs.jmod' )
+assert ( artifact.exists() && artifact.isFile() ) : 'target file is missing or a directory.'
 
-    Set contents = new HashSet();
+def resourceNames = [
+    'lib/non-first.so',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
+def contents = [] as Set
 
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
+def jar = new JarFile( artifact )
+def jarEntries = jar.entries()
+while ( jarEntries.hasMoreElements() ) {
+    def entry = (JarEntry) jarEntries.nextElement()
+    if ( !entry.isDirectory() ) {
+        // Only compare files
+        contents.add( entry.getName() )
     }
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
-    }
-}
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
 }
 
-return result;
+assert resourceNames == contents
diff --git a/src/it/non-default-config/verify.groovy b/src/it/non-default-config/verify.groovy
index c4f044e..628bb20 100644
--- a/src/it/non-default-config/verify.groovy
+++ b/src/it/non-default-config/verify.groovy
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,60 +17,32 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
+import java.util.jar.*
 
-boolean result = true;
+def target = new File( basedir, 'target' )
+assert ( target.exists() && target.isDirectory() ) : 'target file is missing or not a directory.'
 
-try {
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() ) {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
+def artifact = new File( target, 'jmods/maven-jmod-plugin-non-default-config.jmod' )
+assert ( artifact.exists() && artifact.isFile() ) : 'target file is missing or a directory.'
 
-    File artifact = new File( target, "jmods/maven-jmod-plugin-non-default-config.jmod" );
-    if ( !artifact.exists() || artifact.isDirectory() ) {
-        System.err.println( "target file is missing or a directory." );
-        return false;
-    }
+def resourceNames = [
+    'conf/config.test',
+    'conf/config-sub.test',
+    'classes/module-info.class',
+    'classes/myproject/HelloWorld.class',
+] as Set
 
-    String[] artifactNames = [
-        "conf/config.test",
-        "conf/config-sub.test",
-        "classes/module-info.class",
-        "classes/myproject/HelloWorld.class",
-    ]
+def contents = [] as Set
 
-    Set contents = new HashSet();
-
-    JarFile jar = new JarFile( artifact );
-    Enumeration jarEntries = jar.entries();
-    while ( jarEntries.hasMoreElements() ) {
-        JarEntry entry = (JarEntry) jarEntries.nextElement();
-        if ( !entry.isDirectory() ) {
-            // Only compare files
-            contents.add( entry.getName() );
-        }
-    }
-
-    if  ( artifactNames.length != contents.size() ) {
-        System.err.println( "jar content size is different from the expected content size" );
-        return false;
-    }
-    for ( int i = 0; i < artifactNames.length; i++ ) {
-        String artifactName = artifactNames[i];
-        if ( !contents.contains( artifactName ) ) {
-            System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
-            return false;
-        }
+def jar = new JarFile( artifact )
+def jarEntries = jar.entries()
+while ( jarEntries.hasMoreElements() ) {
+    def entry = (JarEntry) jarEntries.nextElement()
+    if ( !entry.isDirectory() ) {
+        // Only compare files
+        contents.add( entry.getName() )
     }
 }
-catch( Throwable e ) {
-    e.printStackTrace();
-    result = false;
-}
 
-return result;
+assert resourceNames == contents
+