사용자 도구

사이트 도구


gradle:dependencies

차이

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

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
gradle:dependencies [2015/10/22 01:24]
kwon37xi [캐시 관련 명령행 옵션]
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')
 } }
줄 690: 줄 691:
  
 ===== provided ===== ===== provided =====
 +  * Gradle 2.x 에서 최종적으로 ''**compileOnly**'' Scope가 생겼다.
 +  * [[https://github.com/gradle/gradle/blob/master/design-docs/provided-dependencies.md|Gradle Provided Dependencies design]]
 +  * 따라서 아래 방법들은 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 방식을 추천.
   * [[http://www.sinking.in/blog/provided-scope-in-gradle/|Provided Scope in Gradle | Sinking In]] 참조 문서   * [[http://www.sinking.in/blog/provided-scope-in-gradle/|Provided Scope in Gradle | Sinking In]] 참조 문서
줄 772: 줄 789:
 ./gradlew dependencyInsight --configuration testCompile --dependency junit  ./gradlew dependencyInsight --configuration testCompile --dependency junit 
 </code> </code>
 +
 +===== CompositeBuild =====
 +  * [[https://docs.gradle.org/current/userguide/composite_builds.html|Gralde Composite Build]] 여러 프로젝트 연관관계가 있을 때 다른 의존 프로젝트를 리포지토리에 올리지 않고 로컬에 있는 상태로 의존할 수 있게 해준다.
 +  * [[https://github.com/gradle/gradle/tree/c7da24ebff119eacc8899ce1c609dd0d426f1243/subprojects/docs/src/samples/compositeBuilds/basic|gradle/subprojects/docs/src/samples/compositeBuilds/basic at c7da24ebff119eacc8899ce1c609dd0d426f1243 · gradle/gradle]]
 +  * [[https://blog.jetbrains.com/idea/2017/03/webinar-recording-composite-builds-with-gradle/|Webinar Recording: Composite Builds with Gradle and IntelliJ IDEA 2017.1 | IntelliJ IDEA Blog]]
 +  * ''settings.gradle''에서 <code groovy>
 +includeBuild '../another_project''
 +</code>
 +
 +===== Source Dependency =====
 +  * [[https://dzone.com/articles/introducing-source-dependencies-in-gradle|Introducing Source Dependencies in Gradle - DZone Java]]
  
 ===== 참조할 DSL ===== ===== 참조할 DSL =====
줄 780: 줄 808:
   * [[http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ConfigurationContainer.html|ConfigurationContainer]]   * [[http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ConfigurationContainer.html|ConfigurationContainer]]
   * [[http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.Configuration.html|Configuration]]   * [[http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.Configuration.html|Configuration]]
 +
 +
 +===== Dependency Management Plugin =====
 +https://github.com/spring-gradle-plugins/dependency-management-plugin
 +
 +
gradle/dependencies.1445446455.txt.gz · 마지막으로 수정됨: 2015/10/22 01:24 저자 kwon37xi