Skip to content

Instantly share code, notes, and snippets.

@saichaitanyan
Created January 31, 2019 11:47
Show Gist options
  • Save saichaitanyan/c5eacd0b00c9232e689ace5e5efaa248 to your computer and use it in GitHub Desktop.
Save saichaitanyan/c5eacd0b00c9232e689ace5e5efaa248 to your computer and use it in GitHub Desktop.
Build jar file using IntelliJ platform

#Building artifacts You can initiate building an artifact yourself: Build | Build Artifacts.

You can as well build an artifact by executing a run/debug configuration:

In the corresponding run/debug configuration, add the Build artifact task to the Before launch task list. The artifact will be built automatically when you execute the run/debug configuration (Run | Run or Run | Debug).

Including the Build artifact task in a run/debug configuration makes sense when the run/debug configuration somehow uses the corresponding artifact, e.g. starts the application packaged in a JAR artifact or deploys a WAR or EAR artifact to an application server.

By default, an artifact, when built, is placed into the out/artifacts/<artifact_dir> folder.

#Build options (Build, Rebuild, etc.) When building an artifact (Build | Build Artifacts), you have the following options:

Build. When used for the first time, the whole artifact is built. Each next time you use this option, only the part of the artifact affected by the changes you have made since the last build is built and added to the output folder.

Rebuild. Build the whole artifact as if for the first time. Technically, this is Clean followed by Build.

Clean. Delete all the contents of the artifact output directory.

Edit. Edit the artifact configuration.

#Running JAR artifacts To run Java applications packaged in Java archives (JARs), IntelliJ IDEA provides the JAR Application run configurations. To create such a run configuration:

Open the Run/Debug Configurations dialog (e.g. Run | Edit Configurations).

Click icons general add svg and select JAR Application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment