Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change dependencies of dependency configuration ':app:implementation' after it has been included in dependency resolution #55

Closed
shenshuo opened this issue Jun 13, 2022 · 4 comments

Comments

@shenshuo
Copy link

直接从project.configurations 中获取dependencies 报这个错的原因是什么

@trycatchx
Copy link
Owner

@shenshuo
对于 gradle.properties 中的配置:如果使用 org.gradle.configureondemand = true ,请删除或者设置为 false,目前在 window 的 as 上会出现问题,已纳入下期需求

@shenshuo
Copy link
Author

@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中获取到项目的依赖库的名称版本号一类的方案吗

@trycatchx
Copy link
Owner

trycatchx commented Jun 14, 2022

@shenshuo
非常幸运的是之前团队基于 RocketX 衍生了一个 DenpendcyX 的插件。
DenpendcyX :主要输出项目中的每一个module 的 父依赖和子依赖到 excel 中的 sheet1 和 sheet2 中,方便排查项目 module的依赖情况。(但是目前只是输出了module 之间的依赖情况),你可以根据要求开放查看所有的依赖包括网络依赖

只需要屏蔽 DependencyPlugin.kt 中:
if (it is DefaultProjectDependency) 这行代码,就可以看到所有的依赖情况。

有兴趣可以尝试一下:

DenpendcyX.zip

@Wensibob
Copy link

Wensibob commented Sep 9, 2022

步骤:
1、开启插件,第一次跑没问题
2、再跑一次报错,报错如下图所示,项目没有设置org.gradle.configureondemand = true
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants