/** * Specifically for Maven * * @param properties * the properties */ public static Properties getManifest(File dirOrJar) throws IOException { Analyzer analyzer = new Analyzer(); analyzer.setJar(dirOrJar); Properties properties = new Properties(); properties.put(IMPORT_PACKAGE, "*"); properties.put(EXPORT_PACKAGE, "*"); analyzer.setProperties(properties); Manifest m = analyzer.calcManifest(); Properties result = new Properties(); for (Iterator<Object> i = m.getMainAttributes().keySet().iterator(); i .hasNext();) { Attributes.Name name = (Attributes.Name) i.next(); result.put(name.toString(), m.getMainAttributes().getValue(name)); } return result; }
/** * Specifically for Maven * * @param properties * the properties */ public static Properties getManifest(File dirOrJar) throws Exception { Analyzer analyzer = new Analyzer(); try { analyzer.setJar(dirOrJar); Properties properties = new Properties(); properties.put(IMPORT_PACKAGE, "*"); properties.put(EXPORT_PACKAGE, "*"); analyzer.setProperties(properties); Manifest m = analyzer.calcManifest(); Properties result = new Properties(); for (Iterator<Object> i = m.getMainAttributes().keySet().iterator(); i.hasNext();) { Attributes.Name name = (Attributes.Name) i.next(); result.put(name.toString(), m.getMainAttributes().getValue(name)); } return result; } finally { analyzer.close(); } }
analyzer.setProperties(properties);
analyzer.setProperties(properties);
analyzer.setProperties(properties);
analyzer.setProperties(properties);