I want to get to read from the Manifest of my Jar file to get the SVNVersion info from there and show it in the UI. I work on a multi-module project that includes a client, a server running on tomcat, some modules of the client and its dependencies.
I wrote the code to access the current thread's manifest and get it's attributes.
Manifest mf = new Manifest();
mf.read(Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/MANIFEST.MF"));
Attributes atts = mf.getMainAttributes();
System.out.println(atts.values());
System.out.println("Version: " + atts.getClass());
System.out.println("Revision: " + atts.get("SCM-Revision"));
String scm = (String) atts.get("SCM-Revision");
String revision = (String) atts.get("Revision-Number");
return revision + scm;
}
The only thing is that it gets Null values returned because it get's the manifest of a dependency from the local repository that doesn't have the information i need inside of it.
Is there a solution to my problem? to specify a module from the project in a way so it know's to get IT's jar's Manifest and not the one from the dependency? Thank you!