azev
V2EX  ›  问与答

gradle 如何 build 一个包含依赖的可执行的单一 jar 包?

  •  
  •   azev · Oct 18, 2018 · 2433 views
    This topic created in 2853 days ago, the information mentioned may be changed or developed.
    我看官方的教程里输出的是个 zip 包或者 tar 包,要执行还得解开,其中主程序文件跟依赖文件在不同文件夹里.
    那么怎么生成一个包含依赖的可执行 jar 文件呢?
    在网上搜了下说是可以用 com.github.johnrengelman.shadow 这个插件
    但是官方没有自己的方案吗?
    3 replies    2018-10-18 11:21:21 +08:00
    heiybb
        1
    heiybb  
       Oct 18, 2018
    https://docs.gradle.org/current/userguide/tutorial_java_projects.html
    这里有写呀 而且好像没需要额外的插件
    (自己暂时还没用过)
    gaius
        2
    gaius  
       Oct 18, 2018
    maven 也用的插件吧 我记得是叫 shade
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3175 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 12:41 · PVG 20:41 · LAX 05:41 · JFK 08:41
    ♥ Do have faith in what you're doing.