impossible to specify a jar's META-INF/MANIFEST.MF file?
Version: 12.1.6 (the latest prd release of IntelliJ).
Goal: create a "complete" jar file of a particular module. That, is, all the direct resources of a module (its .class files, .java files, config files) plus all of its dependent resources (i.e. the contents of all the jar files it depends on need to be "exploded" into the final jar file).
I want explicit control of how I create a jar file. So, I do the following procedure:
--File --> Project Structure --> Artifacts --> + --> Jar --> Empty
--in the new Artifact tab:
--Name: <someName>
--Output directory: <somePath>
--"Build on make" checked
--under the Output Layout tab:
--click on the + button, select Module Output, and then select a particular module
--click on the + button, select Extracted Directory, select the module's lib directory, and then control click with mouse to add all of the jar files
NOTE: Extracted Directory means that the contents of these jars files, not the jar files themselves, will get extracted and added to this jar file
--click on the + button, select Directory Content, and select the module's config directory
--click on the + button, select Directory Content, and select the module's src directory
The sole problem with the above procedure is that I seemingly have no way to specify the exact META-INF/MANIFEST.MF file used in the jar. When I follow this procedure, I see no way in IntelliJ to select what META-INF/MANIFEST.MF is used.
I think the reason why IntelliJ presented me with no way to specify the META-INF/MANIFEST.MF file is because it found a META-INF/MANIFEST.MF file in one of my dependent jar files that I am including (see the first bolded line above).
I say this because in a different module, which has no dependent jars, when I do an analogous procedure IntelliJ in the Artifacts dialog at the bottom shows a message about the META-INF/MANIFEST.MF not being found. IntelliJ presents me with buttons to either "Create Manifest..." or "Use Existing Manifest...".
I think that this is a bug in IntelliJ: you should never be forced to accept a META-INF/MANIFEST.MF from one of your dependent included jars, but should always have the ability to specify that that file comes from a particular location.
Before I file a bug report with Jetbrains, however, I would love for you guys to let me know if I actually overlooked some way to specify the META-INF/MANIFEST.MF. I have searched the IntelliJ GUI, and done a web search too, and I do not see any solution,
I only know of one hacky solution, that works in my particular case: IntelliJ, if it finds a META-INF/MANIFEST.MF file in any resource as you add it to the jar, seems to always use the first one that it comes across. So, you might be able to change the order in the procedure above to accomplish what you want. For example, if the META-INF/MANIFEST.MF that you want is actually in your src directory (it is for me), then if I add src before adding the jars in lib, I can achieve my desired goal. I still think that IntelliJ should offer more explicit control, however.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note to the IntelliJ developers: there is another thing about the Artifact dialog that I do not like.
In my procedure above, first italicized line, I have to select each individual jar file in my lib directory. But I wish that I could select just the directory, and IntelliJ would know to add all jars inside. Would be a lot more convenient and bug-proof when you have a module with 20 dependent jars.
Please sign in to leave a comment.