Created
April 25, 2013 02:30
-
-
Save ebridges/5457090 to your computer and use it in GitHub Desktop.
Revisions
-
ebridges created this gist
Apr 25, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ import java.io.*; import java.util.*; import java.util.jar.*; public class JarList { public static void main (String args[]) throws IOException { if (args.length != 1) { System.out.println("Please provide a JAR filename"); System.exit(-1); } JarFile jarFile = new JarFile(args[0]); Enumeration enu = jarFile.entries(); while (enu.hasMoreElements()) process(jarFile, enu.nextElement()); } private static void process(JarFile jarFile, Object obj) throws IOException { JarEntry entry = (JarEntry)obj; String name = entry.getName(); if(name.endsWith("pom.properties")) { InputStream is = jarFile.getInputStream(entry); Properties p = new Properties(); p.load(is); String g = p.getProperty("groupId"); String a = p.getProperty("artifactId"); String v = p.getProperty("version"); System.out.println(g+":"+a+":"+v); } } }