IntelliJ IDEA maven references local jar files

1. Background

For some specific reasons, the required version of the jar file cannot be downloaded in the remote maven repository, and the local jar file needs to be referenced in maven.


Two, the solution

1. Create the libs directory

In order to facilitate jar package management, you can create a libs directory at the same level as the src directory in the project directory. as follows:
insert image description here

2. The project module introduces dependencies

1)File --> Project Structure --> Modules --> Dependices --> 添加 JARs or Directories
insert image description here

2) Select the jar file that needs to be referenced
insert image description here

3)Apply --> OK
insert image description here

3. Add pom reference

insert image description here
as follows:

<dependencies>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc15</artifactId>
            <version>10.2.0.4.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/ojdbc15-10.2.0.4.0.jar</systemPath>
        </dependency>
    </dependencies>

Guess you like

Origin blog.csdn.net/aikudexiaohai/article/details/131368845