Age*_*dit 5 java dependency-management gradle
在 gradle 中,我sourceSet为这样的服务测试创建了一个新的:
sourceSets{
servicetest{
java.srcDirs = [//path to servicetests]
}
}
Run Code Online (Sandbox Code Playgroud)
此源集取决于 TestNG,因此我希望通过执行以下操作来降低依赖性:
dependencies{
servicetest(group: 'org.testng', name: 'testng', version: '5.8', classifier: 'jdk15')
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,这会返回一个错误。有什么方法可以声明特定的依赖项sourceSet还是我不走运?
最近的 Gradle 版本会为每个源集 'foo' 自动创建和连接配置 'fooCompile' 和 'fooRuntime'。
如果您仍在使用旧版本,则可以声明自己的配置并将其添加到源集的 compileClasspath 或 runtimeClasspath。就像是:
configurations {
serviceTestCompile
}
sourceSets {
serviceTest {
compileClasspath = configurations.serviceTestCompile
}
}
dependencies {
serviceTestCompile "org.testng:testng:5.8"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8938 次 |
| 最近记录: |