第八篇:Spring Boot引入本地jar包,并且打包把本地jar打进去

引入本地jar

  1. <dependency>  
  2.     <groupId>com.abc</groupId>  
  3.     <artifactId>bbb</artifactId>  
  4.     <version>1.0.0</version>  
  5.     <scope>system</scope>  
  6.     <systemPath>${project.basedir}/libs/bbb-1.0.0.jar</systemPath>  
  7.   </dependency> 

${project.basedir}表示项目所在根目录

打包成jar

给Spring Boot的打包插件设置一下includeSystemScope参数即可

  1. <build>  
  2.   <plugins>  
  3.     <plugin>  
  4.       <groupId>org.springframework.boot</groupId>  
  5.       <artifactId>spring-boot-maven-plugin</artifactId>  
  6.       <configuration>  
  7.         <includeSystemScope>true</includeSystemScope>  
  8.       </configuration>  
  9.     </plugin>  
  10.   </plugins>  
  11. </build>  

打包命令:mvn clean package

如果jar包已经安装到本地仓库,则无需增加includeSystemScope参数。

猜你喜欢

转载自blog.csdn.net/mzh_cn/article/details/80586492