사용자 도구

사이트 도구


gradle:dependencies

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
gradle:dependencies [2018/05/17 09:01]
kwon37xi [CompositeBuild]
gradle:dependencies [2020/09/01 12:31] (현재)
kwon37xi [파일 의존성]
줄 278: 줄 278:
     runtime files('libs/a.jar', 'libs/b.jar')     runtime files('libs/a.jar', 'libs/b.jar')
     runtime files('dir/to/classes') // 디렉토리 자체를 클래스패스에 추가     runtime files('dir/to/classes') // 디렉토리 자체를 클래스패스에 추가
 +    runtime rootProject.files('root-project-dir') // rootProject의 디렉토리를 클래스패스에 추가
     runtime fileTree(dir: 'libs', include: '*.jar')     runtime fileTree(dir: 'libs', include: '*.jar')
 } }
줄 693: 줄 694:
   * [[https://github.com/gradle/gradle/blob/master/design-docs/provided-dependencies.md|Gradle Provided Dependencies design]]   * [[https://github.com/gradle/gradle/blob/master/design-docs/provided-dependencies.md|Gradle Provided Dependencies design]]
   * 따라서 아래 방법들은 Gradle 구버전에서만 사용하고 최신 버전에서는 ''compileOnly''를 사용한다.   * 따라서 아래 방법들은 Gradle 구버전에서만 사용하고 최신 버전에서는 ''compileOnly''를 사용한다.
 +  * ''compileOnly'' 는 의존성이 test 로 이행되지 않기 때문에 test 에는 ''testCompile'' 의존성으로 지정하거나 혹은 아래와 같이 강제로 이행처리를 해야한다. [[https://discuss.gradle.org/t/compileonly-dependencies-are-not-available-in-tests/15366/6|compileOnly dependencies are not available in tests]]
 +<code>
 +sourceSets {
 +    test.compileClasspath += configurations.compileOnly
 +    test.runtimeClasspath += configurations.compileOnly
 +}
  
 +// 혹은
 +configurations {
 +    testImplementation.extendsFrom compileOnly
 +}
 +</code>
  
 아래 모든 방법들을 사용하기 보다는 [[gradle:web|Gradle Web(War) Plugin]] 에 나오는 exclude 방식을 추천. 아래 모든 방법들을 사용하기 보다는 [[gradle:web|Gradle Web(War) Plugin]] 에 나오는 exclude 방식을 추천.
줄 785: 줄 797:
 includeBuild '../another_project'' includeBuild '../another_project''
 </code> </code>
 +
 +===== Source Dependency =====
 +  * [[https://dzone.com/articles/introducing-source-dependencies-in-gradle|Introducing Source Dependencies in Gradle - DZone Java]]
 +
 ===== 참조할 DSL ===== ===== 참조할 DSL =====
   * [[http://www.gradle.org/docs/current/dsl/org.gradle.api.Project.html#org.gradle.api.Project:configurations(groovy.lang.Closure)|Project.configurations()]]   * [[http://www.gradle.org/docs/current/dsl/org.gradle.api.Project.html#org.gradle.api.Project:configurations(groovy.lang.Closure)|Project.configurations()]]
gradle/dependencies.1526515289.txt.gz · 마지막으로 수정됨: 2018/05/17 09:01 저자 kwon37xi