maven项目pom文件引入本地jar包并打包的配置

一、将jar包拷贝到项目文件夹响应位置,一般放到/src/main/webapp下
二、在pom.xml文件中加入以下标签内容
<dependency>
   <groupId>credibledata</groupId>
   <artifactId>credibledata</artifactId>
   <version>2.1</version>
   <scope>system</scope>
   <systemPath>${project.basedir}/src/main/webapp/credibledata-envelop-1.0-SNAPSHOT.jar</systemPath>
</dependency>

<dependency>
   <groupId>jdk15on</groupId>
   <artifactId>jdk15on</artifactId>
   <version>2.1</version>
   <scope>system</scope>
   <systemPath>${project.basedir}/src/main/webapp/bcprov-jdk15on-1.57.jar</systemPath>
</dependency>

三、在pom.xml文件的<build>标签的子标签<plugins>的子标签<plugin>下加入如下标签配置

<configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>

如图所示,是添加后的配置

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
            </plugin>
        </plugins>
    </build>

第三步是为了能让本地引入的jar包在打包时可以打到jar里去。


原文地址:https://www.cnblogs.com/zhncnblogs/p/14600636.html