Closed shenshuo closed 2 years ago
@shenshuo 对于 gradle.properties 中的配置:如果使用 org.gradle.configureondemand = true ,请删除或者设置为 false,目前在 window 的 as 上会出现问题,已纳入下期需求
@trycatchx
我想在自己的plugin中 获取到项目的依赖库内容
project.configurations.each { Configuration conf ->
if (conf.isCanBeResolved()) {
println conf.incoming.resolutionResult.root.dependencies
}
就报 Cannot change dependencies of dependency configuration ':app:implementation' after it has been included in dependency resolution
请问有什么方法实现在plugin中获取到项目的依赖库的名称版本号一类的方案吗
@shenshuo 非常幸运的是之前团队基于 RocketX 衍生了一个 DenpendcyX 的插件。 DenpendcyX :主要输出项目中的每一个module 的 父依赖和子依赖到 excel 中的 sheet1 和 sheet2 中,方便排查项目 module的依赖情况。(但是目前只是输出了module 之间的依赖情况),你可以根据要求开放查看所有的依赖包括网络依赖
只需要屏蔽 DependencyPlugin.kt 中:
if (it is DefaultProjectDependency)
这行代码,就可以看到所有的依赖情况。
有兴趣可以尝试一下:
步骤: 1、开启插件,第一次跑没问题 2、再跑一次报错,报错如下图所示,项目没有设置org.gradle.configureondemand = true
直接从project.configurations 中获取dependencies 报这个错的原因是什么