用 Gradle 构建一个 uberjar [英] Building an uberjar with Gradle
本文介绍了用 Gradle 构建一个 uberjar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想构建一个包含项目所有可传递依赖项的 uberjar(又名 fatjar).我需要在 build.gradle
中添加哪些行?
I want to build an uberjar (AKA fatjar) that includes all the transitive dependencies of the project. What lines do I need to add to build.gradle
?
这是我目前拥有的:
task uberjar(type: Jar) {
from files(sourceSets.main.output.classesDir)
manifest {
attributes 'Implementation-Title': 'Foobar',
'Implementation-Version': version,
'Built-By': System.getProperty('user.name'),
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version'),
'Main-Class': mainClassName
}
}
推荐答案
您是否尝试过 gradle 食谱?
您正在寻找的是 gradle 的 shadow 插件
这篇关于用 Gradle 构建一个 uberjar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文