使用Gradle构建可执行JAR
作者:
花绽放水流年 | 来源:发表于
2017-06-22 15:44 被阅读36次build.gradle 中按如下配置
apply plugin: 'java'
apply plugin: 'idea'
jar {
String someString = ''
configurations.runtime.each {
someString = someString + "lib/" + it.name + " ";
}
manifest {
attributes 'Main-Class': 'xxx'//这里填写入口函数所在类全限定名
attributes 'Class-Path': someString
}
}
//清除上次的编译过的文件
task clearPj(type: Delete) {
delete 'build', 'target'
}
//把JAR复制到目标目录
task release(type: Copy, dependsOn: [build]) {
from configurations.runtime
into 'build/libs/lib'
}
本文标题:使用Gradle构建可执行JAR
本文链接:https://www.haomeiwen.com/subject/amefcxtx.html
网友评论