1. 将第三方jar包放入项目下的lib(lib由自己创建)
2. maven标签中添加scope标签
<scope>system</scope>
3.添加systemPath标签
<systemPath>${project.basedir}/lib/第三方jar名称</systemPath>
4.打包配置
引入本地包就是如此的简单,在开发完成部署时,我们会发现打的包中没有我们引入的本地jar,此时需要添加下列插件。
这两个插件是有区别的,一个是打出jar包时使用,一个是打成war包使用
这个是jar包时使用,没什么好说的
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
这个打成war包使用,需要对directory进行说明,它是我们存放本地包的文件名称
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>lib</directory>
<targetPath>WEB-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
网友评论