如何深入了解“实施”的依赖关系组态?

编程入门 行业动态 更新时间:2024-10-26 18:20:44
本文介绍了如何深入了解“实施”的依赖关系组态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

基于文档( 4.7.6 - 深入了解特定依赖关系),我们可以获得指定配置本身的特定配置的见解。 在他们用作配置 compile 的示例中,不建议使用。 我尝试在 build.gradle 中替换 compile 配置中的 implementation 配置(因为我得到了,我们不应该使用 compile 了)。 但是当我运行时:

gradle dependencyInsight --dependency groovy --configuration implementation

Gradle正在返回:

任务':dependencyInsight'的执行失败。 不允许直接解析配置'implementation'

My build .gradle 文件如下:

apply plugin:'java-library' 存储库{ jcenter()} 依赖项{ implementation'org.codehaus.groovy:groovy-all:2.4.10' $ b

这是否意味着如果我使用执行还是有另一种方法来获取它吗?

解决方案

问题,然后问周围,并得到了答案:

配置是compileClasspath。如果您有变体,则每个变体都有一个配置(例如,对于版本变体,您的配置将为 releaseCompileConfiguration )。 完整示例 - 无变体: gradle dependencyInsight --dependency groovy --configuration compileClasspath 完整示例 - 发布变体: gradle dependencyInsight --dependency groovy --configuration releaseCompileClasspath

Based on documentation (4.7.6 - Getting the insight into a particular dependency) we can get the insights for a particular configuration specifying the configuration itself. In the example they are using as configuration compile, which is deprecated. I tried to reproduce the same command replacing, in build.gradle, the compile configuration with the implementation configuration (as I got we are not supposed to use compile anymore). But when I run:

gradle dependencyInsight --dependency groovy --configuration implementation

Gradle is returning:

Execution failed for task ':dependencyInsight'. Resolving configuration 'implementation' directly is not allowed

My build.gradle file is the following:

apply plugin: 'java-library' repositories { jcenter() } dependencies{ implementation 'org.codehaus.groovy:groovy-all:2.4.10' }

Does it mean I cannot get the insight of a dependency if I'm using implementation or is there another way to get it?

解决方案

I had a similar problem, and asked around, and got this answer:

The configuration is compileClasspath. If you have variants, there is a configuration per-variant (i.e. for the release variant, your configuration would be releaseCompileConfiguration). full example - no variants: gradle dependencyInsight --dependency groovy --configuration compileClasspath full example - release variant: gradle dependencyInsight --dependency groovy --configuration releaseCompileClasspath

更多推荐

如何深入了解“实施”的依赖关系组态?

本文发布于:2023-07-30 00:44:59,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:组态   关系

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!