1. Introduction
IntelliJ IDEA is an integrated development environment (IDE) developed by JetBrains. Including external JAR is essential for various reasons as the project may access external libraries or may need external jars when developing offline. In this example, I will show three common ways to include external JAR in an IntelliJ project.
- Include external JAR to a Maven project.
- Include external JAR to a Gradle Project.
- Include external JAR to a Java project.
2. Intellij Include External JAR in Maven Project
It’s best to include external JAR as dependencies in pom.xml for a Maven project. Here is an example to add lombok.jar to the pom.xml file.
pom.xml
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.36</version> <scope>provided</scope> </dependency>
After pom.xml is updated, click View-> Maven Tool Window and then click the "Reload All Maven Projects” icon. You can verify the lombok.jar under the project’s “Dependencies” folder as Figure 1.
3. Intellij Include External JAR in Gradle Project
For a Gradle project, it’s best to add external JARs under the dependencies section in the build.gradle file. Here is an example to add the lombok.jar
build.gradle
// https://mvnrepository.com/artifact/org.projectlombok/lombok compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.36'
Click the “Load Gradle Changes” icon or run the gradle build task. Verify the external JARs added under “External Libraries” in Figure 2.
4. Intellij Include External JAR in Java Project
For the project without Maven/Gradel, we can add external JAR via its “Project Structure” feature with the following steps:
- Prepare the external JARs. For this example, I downloaded the
lombok.jarfrom the Maven Repository website and stored it in my PC’sDownloadsfolder. - In IntelliJ IDE, click
File->Project Structure ...,then it pops a new “Project Structure” window. - Click the “
Modules” under “Project Settings” in the “Project Structure” window. - Click the “
Dependencies” tab and then click the “+” and select the “1. JARs or Directories...” option in Figure 3. - Select the
lombok.jarfrom theDownloadfolder and click the “Apply” then “OK” buttons in Figure 4. - Verified the
lombok.jaris included under the “External Libraries” in Figure 5.
Add JARs
Add Lombok.jar
Verify The External JAR is Added
5. Conclusion
In this step, I donmonstrated three ways to include external JAR to an IntelliJ project.
- Include external JAR to a Maven project via
pom.xml - Include external JAR to a Gradle Project via
build.gradle - Include external JAR to a Java project via “
Project Structure” setting.
Thank you!
We will contact you soon.

This site uses Akismet to reduce spam. Learn how your comment data is processed.