import java.io.*; import java.util.*; import java.util.jar.*; import java.util.regex.*; File jarFile = new File( basedir, "junit-3.8.2-bundle.jar" ); System.out.println( "Checking for existence of " + jarFile ); if ( !jarFile.isFile() ) { throw new IllegalStateException( "Missing file: " + jarFile ); } JarFile jar = new JarFile( jarFile ); String[] includedEntries = { "pom.xml", "junit-3.8.2.jar", }; for ( String included : includedEntries ) { System.out.println( "Checking for existence of " + included ); if ( jar.getEntry( included ) == null ) { throw new IllegalStateException( "Missing archive entry: " + included ); } } jar.close(); return true;