문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
gradle:java [2017/01/03 17:46] kwon37xi [JavaExec] |
gradle:java [2018/12/05 13:31] kwon37xi [기본 디렉토리 구조] |
||
---|---|---|---|
줄 39: | 줄 39: | ||
// 소스 인코딩 지정방법 1 | // 소스 인코딩 지정방법 1 | ||
- | [compileJava, | + | [compileJava, |
// 소스 인코딩 지정밥법 2 | // 소스 인코딩 지정밥법 2 | ||
tasks.withType(JavaCompile) { | tasks.withType(JavaCompile) { | ||
+ | options.encoding = ' | ||
+ | } | ||
+ | javadoc { | ||
options.encoding = ' | options.encoding = ' | ||
} | } | ||
줄 62: | 줄 65: | ||
* 빌드 결과 : '' | * 빌드 결과 : '' | ||
* '' | * '' | ||
+ | * '' | ||
===== 기본 태스크 ===== | ===== 기본 태스크 ===== | ||
* '' | * '' | ||
줄 269: | 줄 272: | ||
|title | String | 프로젝트 이름과 버전 | | |title | String | 프로젝트 이름과 버전 | | ||
* [[http:// | * [[http:// | ||
+ | |||
+ | ==== Java 9 HTML5 javadoc ==== | ||
+ | * [[java: | ||
+ | * [[http:// | ||
+ | < | ||
+ | javadoc { | ||
+ | options.addBooleanOption(' | ||
+ | } | ||
+ | </ | ||
+ | |||
==== 멀티 모듈의 소스를 합쳐 Javadoc 생성 ==== | ==== 멀티 모듈의 소스를 합쳐 Javadoc 생성 ==== | ||
줄 466: | 줄 479: | ||
* '' | * '' | ||
- | ==== 테스트의 분리 ==== | + | ==== 테스트의 분리 |
* '' | * '' | ||
* [[http:// | * [[http:// | ||
줄 494: | 줄 507: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ==== 테스트의 분리 - 소스셋 분리 - 권장 ==== | ||
+ | * [[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 ==== |