使用Gradle构建uberjar [英] Building an uberjar with Gradle

查看:72
本文介绍了使用Gradle构建uberjar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建一个包含项目的所有传递依赖项的uberjar(AKA 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
    }
}

推荐答案

您是否尝试过您正在寻找的是 shadow插件

这篇关于使用Gradle构建uberjar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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