Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Wrong manifest file read #1
I experienced a problem, when using getVersionNameFromManifest() in combination with a JAR. Then unfortunately, a META-INF/MANIFEST.MF from the classpath is read, and not the one from the actual package which includes the "versionName".
In my simple example the META-INF/MANIFEST.MF from sun.net.www.protocol.jar.JarURLConnection:jar:file:/C:/Program%20Files/Java/jdk1.8.0_172/jre/lib/charsets.jar!/META-INF/MANIFEST.MF is read and thus does not find the key "versionName".
The problem can be tracked down to the code part where the manifest is read using the classloader:
That's a tough one!
I could however reproduce your issue with docker:
docker run --rm -it -v $(pwd):/app piegsaj/oracle-jre:1.8.0_102-b14 java -jar /app/examples/jar/target/jar-1.0.3-SNAPSHOT-jar-with-dependencies.jar 1.0.3-SNAPSHOT (2019-03-21T09:43:49Z, branch develop, commit d36a6c2) docker run --rm -it -v $(pwd):/app openjdk:8u102-jre java -jar /app/examples/jar/target/jar-1.0.3-SNAPSHOT-jar-with-dependencies.jar
Where the second command did not return anything.
Anyways, I implemented a proof of concept that fixed the issue for my docker test stated above.
Don't know if this fixes the issue on your side as well. So could you please validate this