Gradle将项目打成Jar包

2018-08-02  本文已影响67人  大猪大猪

网上实现的方式挺多的,这里选择shadow方式

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "com.github.jengelman.gradle.plugins:shadow:2.0.4"
    }
}

apply plugin: "com.github.johnrengelman.shadow"
version = '0.0.1-SNAPSHOT'
apply plugin: 'java'
group 'com.dounine.gradle'
sourceCompatibility = 1.8

jar {
    manifest {
        attributes 'Implementation-Title': 'Application',
                'Implementation-Version': version,
                'Main-Class': 'com.dounine.gradle.Application'
    }
}
shadowJar {
    zip64 true
}
repositories {
    mavenLocal()
    mavenCentral()
}
dependencies {
        compile(group: 'org.apache.hbase', name: 'hbase-client', version: '2.0.0'){
        exclude group: 'org.slf4j'
    }
}
上一篇下一篇

猜你喜欢

热点阅读