문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
gradle:java [2017/01/03 17:46] kwon37xi [JavaExec] |
gradle:java [2018/05/15 16:08] kwon37xi [Java Project 기본 build.gradle] |
||
---|---|---|---|
줄 39: | 줄 39: | ||
// 소스 인코딩 지정방법 1 | // 소스 인코딩 지정방법 1 | ||
- | [compileJava, | + | [compileJava, |
// 소스 인코딩 지정밥법 2 | // 소스 인코딩 지정밥법 2 | ||
tasks.withType(JavaCompile) { | tasks.withType(JavaCompile) { | ||
+ | options.encoding = ' | ||
+ | } | ||
+ | javadoc { | ||
options.encoding = ' | options.encoding = ' | ||
} | } | ||
줄 466: | 줄 469: | ||
* '' | * '' | ||
- | ==== 테스트의 분리 ==== | + | ==== 테스트의 분리 |
* '' | * '' | ||
* [[http:// | * [[http:// | ||
줄 494: | 줄 497: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ==== 테스트의 분리 - 소스셋 분리 - 권장 ==== | ||
+ | * [[https:// | ||
+ | |||
+ | <code groovy> | ||
+ | // 별도 소스셋 구성 | ||
+ | sourceSets { | ||
+ | integrationTest { | ||
+ | java { | ||
+ | compileClasspath += main.output + test.output | ||
+ | runtimeClasspath += main.output + test.output | ||
+ | srcDir file(' | ||
+ | } | ||
+ | groovy { // for Spock | ||
+ | compileClasspath += main.output + test.output | ||
+ | | ||
+ | srcDir file(' | ||
+ | } | ||
+ | resources.srcDir file(' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // integrationTest 전용 configuration 지정. | ||
+ | // integrationTest에만 필요한 의존성 지정 가능. | ||
+ | |||
+ | configurations { | ||
+ | integrationTestCompile.extendsFrom testCompile | ||
+ | integrationTestRuntime.extendsFrom testRuntime | ||
+ | } | ||
+ | |||
+ | // Task 생성 | ||
+ | task integrationTest(type: | ||
+ | testClassesDirs = sourceSets.integrationTest.output.classesDirs // 구버전에서는 Dir 단수형으로만 지정됨. | ||
+ | classpath = sourceSets.integrationTest.runtimeClasspath | ||
+ | reports { // reports 는 원하는대로만. | ||
+ | junitXml.enabled = true | ||
+ | html.enabled = true | ||
+ | ignoreFailures = true | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // 의존성 지정으로 check 실행시 자동 테스트 | ||
+ | check.dependsOn integrationTest | ||
+ | </ | ||
+ | |||
+ | ==== TestSets Plugin 사용 ==== | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * TBD | ||
==== Convention Values ==== | ==== Convention Values ==== |