gradle打包可执行jar

因项目用到netty 配合gradle构建踩坑,网上找的资料打包可执行jar效果都不好,最后发现了一个方法故分享一下。



version'0.0.1'

applyplugin:'com.github.johnrengelman.shadow'

applyplugin:'application'

applyplugin:'java'

mainClassName ="com.nextcont.drive.WebSocketServer"

sourceCompatibility =1.8

buildscript{

repositories{

maven{

url"https://plugins.gradle.org/m2/"

}

}

dependencies{

classpath"com.github.jengelman.gradle.plugins:shadow:2.0.1"

}

}

dependencies{

compile("io.netty:netty-all:5.0.0.Alpha2")

compile("org.slf4j:slf4j-api:1.7.13")

compile("ch.qos.logback:logback-classic:1.1.3")

compile("com.jcraft:jzlib:1.1.2")

compile("org.json:json:20141113")

compile("commons-codec:commons-codec:1.10")

compile("com.squareup.okhttp3:okhttp:3.6.0")

compile project(":drive-api")

testCompilegroup:'junit',name:'junit',version:'4.12'

}

你可能感兴趣的:(gradle打包可执行jar)