import java.io.*; import java.util.*; import java.util.zip.*; import java.util.regex.*; File jarFile = new File( basedir, "target/test-1.0.jar" ); System.out.println( "Checking for existence of " + jarFile ); if ( !jarFile.isFile() ) { throw new FileNotFoundException( "Missing " + jarFile ); } ZipInputStream zis = new ZipInputStream( new FileInputStream( jarFile ) ); int count = 0; while (true) { ZipEntry entry = zis.getNextEntry(); if ( entry == null ) { break; } if ( entry.getName().equals( "META-INF/ejb-jar.xml" ) ) { count++; } } zis.close(); if ( count != 1 ) { throw new IllegalStateException( "Wrong number of ejb-jar.xml's in archive: " + count ); } return true;