문서의 이전 판입니다!
testFixtures
라는 소스 디렉토리를 추가하고 해당 디렉토리를 하위 모듈에서 테스트로 의존성을 걸게 하면 상위 모듈, 하위 모듈 모두에서 사용가능해진다.// 전역 설정 plugins { // which produces test fixtures id 'java-test-fixtures' } // 상위 모듈 의존성 dependencies { testImplementation 'junit:junit:4.13' // API dependencies are visible to consumers when building testFixturesApi 'org.apache.commons:commons-lang3:3.9' // Implementation dependencies are not leaked to consumers when building testFixturesImplementation 'org.apache.commons:commons-text:1.6' }
dependencies { implementation(project(":상위모듈")) testImplementation 'junit:junit:4.13' testImplementation(testFixtures(project(":상위모듈"))) }