用Gradle构建一个uberjar [英] Building a uberjar with Gradle
本文介绍了用Gradle构建一个uberjar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是一名Gradle新手。我想要构建一个uberjar(AKA fatjar),其中包含项目的所有传递依赖关系。我需要添加哪些行到我的build.gradle?
I am a Gradle novice. I want to build a uberjar (AKA fatjar) that includes all the transitive dependencies of the project. What lines do I need to add to my "build.gradle"?
这是我现在所拥有的:(我从几天前的某处复制它,但不要)
This is what I currently have: (I copied it from somewhere a few days back, but don't recollect from where.)
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 cookbook
你要找的是影子插件 for gradle
What you're looking for is the shadow plugin for gradle
这篇关于用Gradle构建一个uberjar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文