前提背景
公司要封装一个工具类,把常用的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