728x90
Gradle 설정 예제
build.gradle 설정
group 'kafka.think.com'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
mainClassName = 'mainClass'
sourceCompatibility = 1.8
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
}
}
applicationDistribution.from("src/main/resources/logback.xml") {
into "."
}
applicationDistribution.from("src/main/resources/run_da") {
into "."
}
applicationDistribution.from("src/main/resources/run_ka") {
into "."
}
applicationDistribution.from("src/main/resources/Consumer.properties") {
into "."
}
jar {
finalizedBy shadowJar
exclude('logback.xml')
exclude('run_da')
exclude('run_ka')
exclude('Consumer.properties')
manifest {
attributes 'Main-Class': mainClassName
}
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
compile group: 'org.apache.kafka', name: 'kafka-clients', version: '0.10.1.0'
compile group: 'org.apache.hadoop', name: 'hadoop-common', version: '2.7.1'
compile group: 'org.apache.hadoop', name: 'hadoop-hdfs', version: '2.7.1'
compile group: 'commons-daemon', name: 'commons-daemon', version: '1.0.15'
compile group: 'org.apache.hbase', name: 'hbase-client', version: '1.1.3'
}
위와 같이 하면
build/distributions/ 폴더에 압축 데이터가 있다.
해당 파일의 압축을 풀면 바로 실행 시킬수 있는 데이터 폴더가 완성된다.
drwxr-xr-x 2 shwhite shwhite 34 Oct 31 16:47 bin
-rw------- 1 shwhite shwhite 12K Oct 31 16:51 console.txt
-rw-r--r-- 1 shwhite shwhite 217 Oct 31 16:35 Consumer.properties
drwxr-xr-x 2 shwhite shwhite 4.0K Oct 31 16:47 lib
-rw-r--r-- 1 shwhite shwhite 1.4K Oct 31 11:47 logback.xml
drwx------ 2 shwhite shwhite 23 Oct 31 16:48 logs
-rwxr-xr-x 1 shwhite shwhite 406 Oct 31 13:05 run_da
-rwxr-xr-x 1 shwhite shwhite 405 Oct 30 17:34 run_ka
'프로그래밍 > gradle' 카테고리의 다른 글
Gradle 결과물 단일 jar로 만들기 (0) | 2018.03.08 |
---|---|
GRADLE 설치 (0) | 2018.03.08 |