image.png
1,在src下新建目录lib,并将jar包放入该路径内。
2,pom文件内配置 dependencies里面添加依赖
<dependency>
<groupId>com.inspur</groupId>
<artifactId>jqtservice</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/lib/jqtservice-1.0.0.jar</systemPath>
</dependency>
3,关键
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
<includeSystemScope>true</includeSystemScope><!--注意: 如果没有该配置,不能将本地jar包打包输出!!-->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>src/lib</directory>
<targetPath>WEB-INF/lib/</targetPath><!-- 这里写BOOT-INF也行 -->
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
4,最终输出jar的结果里jar包的排序是按引入的顺序排列的
mvn clean package
image.png
网友评论