feat: init build release
This commit is contained in:
28
bin/printJarVer.java
Normal file
28
bin/printJarVer.java
Normal file
@@ -0,0 +1,28 @@
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
public class printJarVer {
|
||||
public static void main(String[] args) {
|
||||
if (args.length == 0) {
|
||||
System.out.println("Please input jars path and file name.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (String jarPath : args) {
|
||||
File jarFile = new File(jarPath);
|
||||
String jarName = jarFile.getName();
|
||||
try (JarFile jar = new JarFile(jarFile)) {
|
||||
Manifest manifest = jar.getManifest();
|
||||
Attributes attributes = manifest.getMainAttributes();
|
||||
String version = attributes.getValue("Implementation-Version");
|
||||
System.out.println(jarName + " version: " + (version != null ? version : "not found version info"));
|
||||
} catch (IOException e) {
|
||||
System.out.println("Can't read " + jarName + " version.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user