随笔 - 234  文章 - 2  评论 - 20  阅读 - 48万

springboot 将本地依赖的 systemPath jar 打包到 fat jar 里面

将本地依赖的 systemPath jar 打包到 springboot fat jar 的最佳实践:

1、依赖本地 jar 包

<dependency>   
    <groupId>com.sap</groupId>  
    <artifactId>sapjco3</artifactId>  
    <version>3.0.12</version>  
    <scope>system</scope>  
    <systemPath>${project.basedir}/src/main/resources/lib/sapjco3.jar</systemPath>  
</dependency>

 

2、打包时将本地依赖的 jar 打入 fat jar 当中

复制代码
<plugins>
      <plugin>
          <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
             <includeSystemScope>true</includeSystemScope>
        </configuration>
      </plugin>
</plugins>
复制代码

参考:https://blog.csdn.net/qq_30698633/article/details/78331920

 

 

如果实在弄不了,只能使用 maven 命令将 jar 发布到公司的 maven 私服,这样就正常依赖,正常打包就可以了。

如果只在打包所有的 jar ,不是打成 fat jar 的话,可以使用  maven-assembly-plugin 或者 maven-antrun-plugin 来将本地依赖的 jar 进行打包。

 

posted on   快鸟  阅读(664)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
历史上的今天:
2020-08-29 @EnableAutoConfiguration 和 @Import 的原理
2019-08-29 Spring BeanFactory 初始化 和 Bean 生命周期
2017-08-29 MySQL慢查询
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示