Eventually, when you're ready to release a version of your code to production, you'll need a .jar
file to distribute. Intellij makes building JARs quite easy.
First, navigate to File -> Project Structure
and click on Artifacts
:
Click on the +
button, and select JAR -> From modules with dependencies
:
Select your module from the dropdown list, and the main file (this is the file that contains your public static void main()
method):
Click OK
, verify that all the information regarding dependencies is correct, and click OK
to finish setting up the artifact.
We're not done yet! We've only told Intellij how to build the artifact, now we actually need to make the .jar
.
Simply click Build -> Build Artifacts
, and click Build
on the popup menu:
The jar
will be found in build -> classes -> artifacts