gradle打包发布到maven的nexus仓库

本文介绍了如何解决使用Gradle打包时,pom文件未包含模块依赖的问题。公司需要将多个工具类封装成一个项目,并发布到Nexus仓库。以前的解决方案通过maven_push.gradle文件进行打包,但无法处理模块依赖。新的打包方案采用maven-publish插件,直接在模块的build.gradle中配置,确保生成的pom.xml包含所有依赖,从而成功发布到Nexus仓库。
摘要由CSDN通过智能技术生成

前提背景

公司要封装一个工具类,把常用的mybatis,apollo,redis,初始化运行检查等等都封装在一起,项目建好了,但是打包发布nexus之后,别的项目死活拉不到依赖包,经查,是gradle打包时生成的pom文件中没有加入模块依赖.

以前的解决方案及问题

以前公司用gradle打包的时候,先新建一个maven_push.gradle ,然后在要打包的模块build.gradle中加上一句

apply from: '../maven_push.gradle'

maven_push.gradle的内容如下:

// The Maven plugin adds support for deploying artifacts to Maven repositories.
// 一个可以让你把库上传到maven仓库的插件
apply plugin: 'maven'
// The signing plugin adds the ability to digitally sign built files and artifacts. These digital signatures can then be used to prove who built the artifact the signature is attached to as well as other information such as when the signature was generated.
// 对库文件进行数字签名的插件,可以通过签名知道谁创建了这个库文件,签名的时间等等信息
apply plugi
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值