gradle将嵌套jar依赖关系捆绑到模块输出jar中 [英] gradle to bundle nested jar dependencies into module output jar

查看:213
本文介绍了gradle将嵌套jar依赖关系捆绑到模块输出jar中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使gradle将一些依赖关系包含到模块中导致jar作为jar?即制造具有嵌套罐的例如罐。在 lib 文件夹中?



这不是Android项目,应该为多模块项目,所以fatJar,uberJar,shadowJar类似的解决方案似乎不适合。
解决方案

你只需要添加一个额外的<$ c


$ b

 任务jarJar(类型:Jar)从 {
baseName = project.name +'-jarjar'$ {b from {configurations.compile}
with jar
}


How to make gradle to included some dependencies into module resulted jar as jar? i.e. to make jar with nested jar's e.g. in lib folder ?

This is not Android project, and this should be done for many modules in multi-module project, so fatJar, uberJar, shadowJar alike solutions seem not to fit.

解决方案

You just need to add an additional from directive to include dependencies in your jar:

task jarJar(type: Jar) {
    baseName = project.name + '-jarjar'
    from { configurations.compile }
    with jar
}

这篇关于gradle将嵌套jar依赖关系捆绑到模块输出jar中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆