Maven将本地jar打入到jar包
背景
由于有些公司只提供jar包,但是在开发时候可以引用,但是最终打包时缺打不进去
1. 将jar包放置到项目根目录
2. 添加pom依赖
<dependency>
<groupId>com.zebra</groupId>
<artifactId>sdk</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ZSDK_API.jar</systemPath>
</dependency>
3. 修改打包配置
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
<!-- maven编译打包将引用的jar包一起打包 -->
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
4. 打包
maven clean
maven install
maven package