Hi I have been trying to use the MANIFEST.MF file ...
# announcements
a
Hi I have been trying to use the MANIFEST.MF file to hold on to some basic metadata info such as the build version... following some Stack Overflow responses which use methods like
Copy code
MyApplication::class.java.`package`.implementationVersion
or
Copy code
Thread.currentThread().contextClassLoader.getResources(JarFile.MANIFEST_NAME)
but they all result in a NULL. I looked deeper, IntelliJ doesn't even create a MANIFEST.MF when Running/Debugging (although it does when `gradle build`'ing a JAR file). Any tips on what I'm doing wrong? (this is NOT an Android project)
b
Check whether IntelliJ delegates compilation to Gradle.
a
some web sites mention a specific option for that: I don't have that option but I think this is the equivalent:
b
The 2nd screenshot is what I meant. Your config look good. Do note the manifest file is generated in a meta-inf subfolder on your classpath. Are you sure you are using the correct path? Secondly: every jar on your classpath could have a manifest. Instead of using the thread, try accessing the classpath via a class.
a
thx for your help. I haven't been able to make it work, tried a bunch of things. However the manifest file DOES get created on a gradle build and therefore the JARs work as expected. So during dev runs I do a null check and handle, in production the data isn't null so all good. thanks again