3种方式使用本地jar包

本文介绍了在面临本地jar包依赖问题时,如何通过手动安装、使用'scope system'以及搭建公共maven仓库这三种方式来解决。详细讲解了不同maven依赖范围如compile、provided、runtime等的含义,并提供了具体的操作步骤和配置示例。
摘要由CSDN通过智能技术生成

在实际开发过程遇到以下问题:

当A依赖B,B依赖C,如果A对B、B对C的依赖pom scope设置为compile,则A对C的依赖与B对C的依赖相同。

这样会产生一个问题:当B依赖的C(C可能是B端的本地包,不在公共仓库上)在A端没有,则使用maven build的时候会报错。

 

依赖传递:

由scope定义

  • compile - this is the default scope, used if none is specified. Compile dependencies are available in all classpaths. Furthermore, those dependencies are propagated to dependent projects.

  • provided - this is much like compile, but indicates you expect the JDK or a container to provide it at runtime. It is only available on the compilation and test classpath, and is not transitive.

  • runtime - this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.

  • test - this scope indicates t

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值