# IntelliJ - Create JAR package ###### tags: `IntelliJ` ![](https://i.imgur.com/ZiMJpBi.png) [TOC] # Introduction Here in IntelliJ, we can find build JAR as **Build Artifacts**. ## What is Artifact? An artifact is an assembly of your project assets that you put together to test, deploy or distribute your software solution or its part. [For More Information, check out IntelliJ Website](https://www.jetbrains.com/help/idea/working-with-artifacts.html) # Set up "Build JAR" PreRequisites ## 1. Open Project Structure > Artifacts Project Structure can be opened through **File** ## 2. Add JAR artifact By using **+** we can add many types of artifacts, in this tutorial, we will use the **JAR** option. And add our exiting project by selecting **From modules with dependencies**. >![](https://i.imgur.com/7ex29as.png)[color=lightblue] ## 3. Add output folder and location && Rename the JAR output **Output Directory and Folder Naming:** Be aware that the **Name** here, represents the location folder name. For instance, it should be the same as the one in the **Output Directory**. >If naming is different, then you will not be able to get any output when running build JAR.[color=red] **JAR Name:** For those, who need to have specific naming for their JAR, you can **right-click** on the jar and rename it. Do not forget to press enter to make sure your file name is renamed. >![](https://i.imgur.com/oS6pqRo.png)[color=lightblue] With this done, you have already set up the requisites for JAR creation. # Build JAR ## How to Build? In IntelliJ, we will not find "Build JAR" but "Build Artifacts". By going to Build > Build Artifacts, we will be able to build the JARs we want. We can either build one by one, or just process all the JARs we have in the workspace(If you did set up the PreRequisites for each project). >![](https://i.imgur.com/sYmRcXQ.png)[color=lightblue] ## Build Artifacts' actions Build Artifact has the following options: * **Build:** * **1st time:** The whole artifact is built. * **2nd or more times:** Updates original artifact with changes you have made since last build and added to the output folder. * **Rebuild:** Build the whole artifact as if for the first time. In simple words, Clean + Build. * **Clean:** Deletes all the contents of the artifact output directory. * **Edit:** Edits the artifact configuration. ## Build JAR success or not? Just check up your output location, if it there then you have succeded! Congrats! If you did not get your JAR: 1. Check up the location and folder name provided. 2. Check that you have not overwritten your artifacts by error. ## Notes >Be sure to have finished the PreRequisites for the creation of JAR in first section for **EACH project(module)**. [color=red] **How we know if we did set up the prerequisites or not?** Just check up the list provided when having selected **Build Artifacts**; and you will know which ones are set up or not.