Gradle Project-Report插件不安全地解析配置

时间:2019-03-21 15:42:09

标签: gradle

当我设置Gradle来执行以下操作以便在多项目构建中聚合html依赖项报告时:

apply plugin: 'project-report'

htmlDependencyReport {
    projects = project.allprojects
}

我收到一堆警告:

  

配置已解决   不能以安全的方式访问该项目。这可能发生在   从不受Gradle或   来自另一个项目。看到   https://docs.gradle.org/5.2.1/userguide/troubleshooting_dependency_resolution.html#sub:configuration_resolution_constraints   更多细节。此行为已被弃用并已安排   将在Gradle 6.0中删除。

我可以从堆栈跟踪中看到该任务的起源:

at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveToStateOrLater(DefaultConfiguration.java:535)
 *  at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$2200(DefaultConfiguration.java:136)
 *  at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationResolvableDependencies.assertArtifactsResolved(DefaultConfiguration.java:1415)
 *  at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationResolvableDependencies.access$3500(DefaultConfiguration.java:1303)
 *  at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationResolvableDependencies$LenientResolutionResult.resolve(DefaultConfiguration.java:1430)
 *  at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationResolvableDependencies$LenientResolutionResult.getRoot(DefaultConfiguration.java:1443)
 *  at org.gradle.api.reporting.dependencies.internal.JsonProjectDependencyRenderer.createDependencies(JsonProjectDependencyRenderer.java:166)
 *  at org.gradle.api.reporting.dependencies.internal.JsonProjectDependencyRenderer.access$000(JsonProjectDependencyRenderer.java:112)
 *  at org.gradle.api.reporting.dependencies.internal.JsonProjectDependencyRenderer$1.transform(JsonProjectDependencyRenderer.java:155)
 *  at org.gradle.api.reporting.dependencies.internal.JsonProjectDependencyRenderer$1.transform(JsonProjectDependencyRenderer.java:149)
 *  at org.gradle.util.CollectionUtils.collect(CollectionUtils.java:205)
 *  at org.gradle.util.CollectionUtils.collect(CollectionUtils.java:200)
 *  at org.gradle.api.reporting.dependencies.internal.JsonProjectDependencyRenderer.createConfigurations(JsonProjectDependencyRenderer.java:149)
 *  at org.gradle.api.reporting.dependencies.internal.JsonProjectDependencyRenderer.renderProject(JsonProjectDependencyRenderer.java:141)
 *  at org.gradle.api.reporting.dependencies.internal.JsonProjectDependencyRenderer.render(JsonProjectDependencyRenderer.java:127)
 *  at org.gradle.api.reporting.dependencies.internal.HtmlDependencyReporter.generateJsFile(HtmlDependencyReporter.java:79)
 *  at org.gradle.api.reporting.dependencies.internal.HtmlDependencyReporter.access$100(HtmlDependencyReporter.java:46)
 *  at org.gradle.api.reporting.dependencies.internal.HtmlDependencyReporter$1.render(HtmlDependencyReporter.java:68)
 *  at org.gradle.api.reporting.dependencies.internal.HtmlDependencyReporter$1.render(HtmlDependencyReporter.java:59)
 *  at org.gradle.reporting.HtmlReportRenderer.render(HtmlReportRenderer.java:42)
 *  at org.gradle.api.reporting.dependencies.internal.HtmlDependencyReporter.render(HtmlDependencyReporter.java:59)
 *  at org.gradle.api.reporting.dependencies.HtmlDependencyReportTask.generate(HtmlDependencyReportTask.java:136)
 *  at java.lang.reflect.Method.invoke(Method.java:498)

是否有任何方法可以汇总此报告而不会收到此警告?

我实际上已经尝试接受建议:

  

在大多数情况下,可以通过定义   解决方案所在的项目中的配置,以及   将其设置为从其他项目中的配置扩展。

达到极限,然后在我的根项目中创建一个新配置,以编程方式扩展每个子项目中每个配置的每个子项目配置,并迫使它们(安全地)得到解决在htmlDependencyReport任务运行之前。我可以看到他们都得到解决,没问题。然后,当该任务运行时,它仍然会产生该错误。

那么有什么办法可以清除此警告?我认为Gradle团队会在发布6.0之前解决此插件的内部问题,但是我想继续运行此报告,并且直到那时都不想在我的构建输出中看到它。

0 个答案:

没有答案