read build time from META-INF/MANIFEST.MF
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 168
- Joined: Fri Feb 28, 2020 4:02 pm
read build time from META-INF/MANIFEST.MF
Post by vishwavaranasi »
hello team , the below method code to read build time from META-INF/MANIFEST.MF works fine in eclipse
where as the same jar deployed to oxygen/plugins folder and then when i try this to from a oxygen plugin its not returning any value?
where as the same jar deployed to oxygen/plugins folder and then when i try this to from a oxygen plugin its not returning any value?
Code: Select all
public static String getMyOxyegnPluginBuidTime() {
String buidTime = null;
try(InputStream manifestStream = MyPluginDetails.class.getClassLoader().getResourceAsStream("META-INF/MANIFEST.MF"))
{
Properties prop = new Properties();
try {
prop.load(manifestStream);
buidTime=(prop.getProperty("Build-Time"));
} catch (IOException ex) {
ex.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
return buidTime;
}
Thanks,
vishwa
vishwa
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: read build time from META-INF/MANIFEST.MF
Hi,
I assume you have a plugin which contains a "custom.jar" with a custom "META-INF/MANIFEST.MF" file inside
When the plugin is loaded in Oxygen there are lots of other JAR libraries loaded in the same class loader, some of them with "META-INF/MANIFEST.MF" files, and the MANIFEST.MF will be returned from the first JAR library in the class loader.
So maybe you need to make the code more flexible, get a list of all "MANIFEST.MF" resources from the class loader, iterate it, find the proper URL and read from it:
Regards,
Radu
I assume you have a plugin which contains a "custom.jar" with a custom "META-INF/MANIFEST.MF" file inside
When the plugin is loaded in Oxygen there are lots of other JAR libraries loaded in the same class loader, some of them with "META-INF/MANIFEST.MF" files, and the MANIFEST.MF will be returned from the first JAR library in the class loader.
So maybe you need to make the code more flexible, get a list of all "MANIFEST.MF" resources from the class loader, iterate it, find the proper URL and read from it:
Code: Select all
Enumeration<URL> resources = this.getClass().getClassLoader().getResources("/META-INF/MANIFEST.MF");
while(resources.hasMoreElements()) {
URL url = resources.nextElement();
if(url.toString().contains("yourlibrary.jar")) {
url.openConnection().getInputStream();
}
}
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 168
- Joined: Fri Feb 28, 2020 4:02 pm
Re: read build time from META-INF/MANIFEST.MF
Post by vishwavaranasi »
Thanks Radu,
the MANIFEST file is inside my custom plugin jar ,
the MANIFEST file is inside my custom plugin jar ,
Thanks,
vishwa
vishwa
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service