Working with Artifacts
On this page:
- What is an artifact?
- Working with artifact configurations
- Building artifacts
- Running JAR artifacts
- Deploying artifacts to application servers and cloud platforms
See also, Project Structure / Artifacts.
What is an 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. Examples are a collection of compiled Java classes or a Java application packaged in a Java archive, a Web application as a directory structure or a Web application archive, etc.
An artifact can be an archive file or a directory structure that includes the following structural elements:
- Compilation output for one or more of your modules
- Libraries included in module dependencies
- Collections of resources (web pages, images, descriptor files, etc.)
- Other artifacts
- Individual files, directories and archives.
Working with artifact configurations
The key part of working with an artifact configuration is specifying the artifact structure and contents on the Output Layout tab.
You can as well build an artifact by executing a run/debug configuration:
In the corresponding run/debug configuration, add the Build <ArtifactName> 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
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 and select JAR Application.
Deploying artifacts to application servers and cloud platforms
Many of the artifact formats (e.g. WAR, Exploded WAR, EAR, Exploded EAR) are suitable for deployment to application servers and cloud platforms. Here is how you deploy such artifacts:
- In a server or cloud run/debug configuration, specify the artifact to be deployed. (Use the Deployment tab or field.)
- Execute the run/debug configuration or use the Deploy command () in the Application Servers, Run or Debug tool window.
Examples of the procedures discussed on this page can be found in the following tutorials: