2 import java.util.zip.*;
3 import java.util.jar.Manifest;
5 File file = new File( basedir, "target/sonar-it-extract-plugin-key-plugin-1.0.jar" );
8 throw new FileNotFoundException( "Could not find generated JAR: " + file );
11 ZipFile zipFile = new ZipFile(file);
12 InputStream input = null;
14 input = zipFile.getInputStream(zipFile.getEntry("META-INF/MANIFEST.MF"));
15 Manifest manifest = new Manifest(input);
16 String key = manifest.getMainAttributes().getValue("Plugin-Key");
17 if (!key.equals("itextractpluginkey")) {
18 throw new Exception("Plugin key is not valid: " + key);