基于文档( 4.7.6 - 深入了解特定依赖关系),我们可以获得指定配置本身的特定配置的见解。 在他们用作配置 compile 的示例中,不建议使用。 我尝试在 build.gradle 中替换 compile 配置中的 implementation 配置(因为我得到了,我们不应该使用 compile 了)。 但是当我运行时:
gradle dependencyInsight --dependency groovy --configuration implementationGradle正在返回:
任务':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 implementationGradle is returning:
Execution failed for task ':dependencyInsight'. Resolving configuration 'implementation' directly is not allowedMy 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
更多推荐
如何深入了解“实施”的依赖关系组态?
发布评论