Gradle从7开始迁移,5到8.0:不推荐使用的配置依赖关系

3duebb1j  于 2023-04-30  发布在  其他
关注(0)|答案(1)|浏览(371)
configurations {
      foo
}

dependencies {
    implementation 'group:name:1.0'

      foo "group1:name1:1.0"
      foo "group2:name2:1.0"
      foo "group3:name3:1.0"

      implementation configurations.foo      <---- deprecated
}

已弃用警告:

Adding a Configuration as a dependency is a confusing behavior which isn't recommended. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0. If you're interested in inheriting the dependencies from the Configuration you are adding, you should use Configuration#extendsFrom instead.

如何更改gradle 8的已弃用行。0?

zsbz8rwp

zsbz8rwp1#

如果你只是想“搞定”,而彻底违反了弃用的精神。..
你可以改变。..
implementation configurations.foo

configurations.foo.allDependencies.each {
    implementation group: it.group, name: it.name, version: it.version
}

也许它比另一个更“不那么令人困惑”?

相关问题