Springboot中如何引入本地jar包,并通过maven把项目成功打包成jar包部署

本地jar包 引入到maven项目中 springboot项目

1.在resources中创建lib 加入jar包
Springboot中如何引入本地jar包,并通过maven把项目成功打包成jar包部署

2.修改pom文件

<dependency>
			<groupId>com.redpacket</groupId>
			<artifactId>umeng.api.client.java.biz</artifactId>
			<version>0.0.1-SNAPSHOT</version>
			<scope>system</scope>
			<systemPath>${project.basedir}/src/main/resources/lib/umeng.api.client.java.biz.jar</systemPath>
		</dependency>
		<dependency>
			<groupId>com.redpacket</groupId>
			<artifactId>umeng.api.client.java.biz-sources</artifactId>
			<version>1.1.8</version>
			<scope>system</scope>
			<systemPath>${project.basedir}/src/main/resources/lib/umeng.api.client.java.biz-sources.jar</systemPath>
		</dependency>

注意:重点是systemPath这个路径必须得是你jar的路径。其他的按照套路填就行,要求不是太严格。${project.basedir}只是一个系统自己的常量,不用管它

如何把项目打成jar,同时把本地jar包也引入进去
直接在maven的pom里给springboot的打包插件引入一下参数就行

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