New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version is missing in package meta-inf #1809
Comments
Thanks, done |
I'm using ColdFusion and Oracle JDK 11.0.15.1. I've updated jsoup to I'm using the following CFML code to dump version and both return an jsoup = createobject("java", "org.jsoup.Jsoup");
writedump(var="#jsoup.getClass().getPackage().getSpecificationVersion()#");
writedump(var="#jsoup.getClass().getPackage().getImplementationVersion()#"); |
@JamoCA I just tested, and this works in Java. Not sure how that translates to ColdFusion though. Package jsoupPackage = Jsoup.class.getPackage();
System.out.println(jsoupPackage.getImplementationTitle());
System.out.println(jsoupPackage.getImplementationVersion()); Produces:
If you can get it to work, or it works for other packages and not jsoup, would be good if you can add that code here. Also, check that your deployed package actually includes the jsoup META-INF/MANIFEST.MF file, as that's where the classloader gets this data from. I noticed packing like a fat-jar (multiple dependent jars + application code), or a shaded jar, will often drop each packages individual manifest and therefore lose the data. In that case, it might be better to create a zip of the jars so the manifests are maintained. |
I've spent a while researching this and it continues to return I started reviewing manifests of other JARs that we use in production. I noticed that PDFBox had a Could a |
I checked PDF Box's implementation of getVersion() -- it's coming from a resource file, not the manifest. Perhaps as a way to workaround the packaging issue in my edit above. https://github.com/apache/pdfbox/blob/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/Version.java So, that might be a good approach. (Although I do note that jsoup used to use resource files for the named character entity definitions, and would see crashes on various Android forks as an app couldn't load jar resources on first install. Hopefully that's improved over the years...) |
I haven't experienced any crashes related to named entities since I've been using the jsoup library. The ability to determine the version programmatically would have been extremely beneficial so I could write workarounds in functions to deal with recent internal changes in function names and/or behavior. I tried this example (which is pretty much the same as yours & mine) and |
For testing, it would be great to get the jsoup version at runtime.
Version 1.15.2 (and before) returns
It shouldn't be that hard: https://stackoverflow.com/questions/921667/how-do-i-add-an-implementation-version-value-to-a-jar-manifest-using-maven
The text was updated successfully, but these errors were encountered: