import java.io.*; import java.util.jar.*; String[] wanted = { "a.properties", }; String[] unwanted = { "b.properties", "junit/framework/TestCase.class", }; JarFile jarFile = new JarFile( new File( basedir, "target/test-1.0.jar" ) ); for ( String path : wanted ) { if ( jarFile.getEntry( path ) == null ) { throw new IllegalStateException( "wanted path is missing: " + path ); } } for ( String path : unwanted ) { if ( jarFile.getEntry( path ) != null ) { throw new IllegalStateException( "unwanted path is present: " + path ); } } jarFile.close();