Home > Java > javaTutorial > How to Integrate External Libraries into Artifact JARs Using IntelliJ IDEA?

How to Integrate External Libraries into Artifact JARs Using IntelliJ IDEA?

Susan Sarandon
Release: 2024-12-16 16:27:10
Original
183 people have browsed it

How to Integrate External Libraries into Artifact JARs Using IntelliJ IDEA?

Integrating External Libraries into Artifact Jars with IntelliJ IDEA

To seamlessly integrate external libraries into an artifact jar, ensuring the preservation of library class accessibility, follow these steps:

Extraction Method:

  1. Navigate to Project Structure (Ctrl/Cmd Alt Shift S).
  2. Select the Artifacts tab and create a new Jar artifact.
  3. Under Output Layout, select Extract to the JAR.
  4. In the Libraries tab, add the external JAR.
  5. Under Project Dependencies, select the dependency.

Linking Method:

  1. In Project Structure, create a new Jar artifact.
  2. Under Output Layout, select Link Files to the JAR.
  3. In the Libraries tab, add the external JAR.
  4. In the Manifest tab, add the following line:
Class-Path: groovy-all-2.4.7.jar
Copy after login

Replace "groovy-all-2.4.7.jar" with the exact name of the external JAR.

  1. Copy the external JAR into the directory containing the artifact JAR.

Example Project:

Refer to the sample project "HelloWithDependencies.zip" for a detailed demonstration of both methods. The artifacts are generated in the "out" directory, with "single" representing the extraction method and "linked" representing the linking method.

The above is the detailed content of How to Integrate External Libraries into Artifact JARs Using IntelliJ IDEA?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template