我有一个多模块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>
答案 0 :(得分:2)
你可以做到
dependencies {
compile project(':shared-module')
testCompile project(path: ':shared-module', configuration: 'testRuntime')
}
答案 1 :(得分:0)
您可以使用星云test jar plugin
<强> 注意 强> 星云已经弃用了这个插件,因为他们认为测试工具应该存在于他们自己的项目中。我倾向于同意他们