我有一个多模块gradle项目,我想使用我的从属模块中共享模块中的一些测试类。
dependencies {
compile project(':shared-module')
testCompile project(':shared-module'), classifier: 'test-jar'
}
第一个依赖项起作用,但是testCompile依赖项不起作用。我似乎找不到它的语法。 Maven等效于:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>shared-module</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
最佳答案
你可以做
dependencies {
compile project(':shared-module')
testCompile project(path: ':shared-module', configuration: 'testRuntime')
}