Paw*_*tko 5 dependency-management gradle
我对旧版本的库 testX 有传递性编译依赖。库 testX 不应该是编译依赖,而是 testCompile 依赖。更重要的是,我想依赖于 testX 的新版本,而不是旧版本。
我有一个部分解决方案,它设置了库的正确版本,但它通过覆盖编译依赖项来工作。但是我在编译时留下了不需要的 textX。
compile group: 'x', name: 'testX', version 'new'
Run Code Online (Sandbox Code Playgroud)
我尝试从编译中排除库 testX 并添加显式 testCompile 依赖项,但排除也从 testCompile 中删除了依赖项。
testCompile group: 'x', name: 'testX', version 'new'
configurations {
compile.exclude group: 'x', module: 'X'
}
Run Code Online (Sandbox Code Playgroud)
您可以通过插入以下命令强制整个项目解析为特定版本。请记住,这还将强制传递依赖项在编译时解析为此版本:
configurations.all {
resolutionStrategy {
force 'x:testX:1.1.1'
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1190 次 |
| 最近记录: |