Two ways to add external jar packages to java projects

1. The first way

1. Click file-->Project Structure on the idea

 2. Select Libraries ---> click the + sign --> select Java

 

 3. Find the location where the jar file is placed, select the jar file, click OK, and then select OK until the next step.

2. The second way (introduce the external jar package into the local maven warehouse) 

Note: Pay attention to modifying to your own jar package name before execution

where -D is the delimiter

groupId: project package name (customized, what name to write when executing, and what name should be written in the pom file)

artifactId: the name of the project (custom, what name to write when executing, and what name should be written in the pom file)

version: version number (custom, what name to write when executing, and what name should be written in the pom file)

file: put the address of the external jar package, plus \jar package name

mvn install:install-file -DgroupId=com.ceshi -DartifactId=ceshi -Dversion=1.0.1-SNAPSHOT -Dfile=D:\ceshi-1.0.1-SNAPSHOT.jar -Dpackaging=jar

after execution

 BUILD SUCCESS: Represents successful execution

How to use: use in idea

For example, execute the above import external ceshi-1.0.1-SNAPSHOT.jar to the local warehouse

Introduced in the pom file

 <dependency>
    <groupId>com.ceshi</groupId>
    <artifactId>ceshi</artifactId>
    <version>1.0.1-SNAPSHOT</version>
 </dependency>

Guess you like

Origin blog.csdn.net/SUMMERENT/article/details/127655519