IntelliJ IDEA 2021.1 Help

Create Jar from modules dialog

File | Project Structure | Artifacts |   the Add button   | JAR | From modules with dependencies

Use this page to specify the settings for your Java archive (JAR). For informaiton on how to create and run the JAR file, refer to Create an artifact configuration for the JAR.

ItemDescription
ModuleThe module that you want to package.
Main classThe fully qualified name of your main application class, the one with the main() method.
JAR files from libraries

The way the JAR files from the module libraries are processed:

  • extract to the target JAR. The JAR contents are decompressed and then packaged together with the module output in a single JAR.

  • copy to the output directory and link via manifest. The JAR files are copied to the artifact output directory as is. The references to the JARs are added to the Class-Path header field of the MANIFEST.MF file that is packaged in the same JAR as the module output.

Directory for META-INF/MANIFEST.MFThe path to the directory in which META-INF/MANIFEST.MF is generated.

If you build your JAR file with IntelliJ IDEA, IntelliJ IDEA will pick the location to the MANIFEST.MF file automatically. If you use other build systems such as Gralde or Maven, you need to use the resources folder to store the MANIFEST.MF file.

Include testsInclude the module's compiled test classes.

Refer to Packaging the application in a JAR for an example of how to create and build a JAR artifact.

Last modified: 08 March 2021