简体   繁体   English

Gradle 不显示依赖树中的所有插件

[英]Gradle does not display all plugins in dependency tree

Use Case用例

I am trying to generate a dependency tree containing all plugins and dependencies for all configurations, but org.sonarqube is not included in the tree.我正在尝试生成一个包含所有配置的所有插件和依赖项的依赖关系树,但org.sonarqube不包含在树中。 I am working with a basic, single-module project and am using Gradle v7.5.1.我正在处理一个基本的单模块项目,并使用 Gradle v7.5.1。

Examples例子

Running the following command outputs most (but not all) dependencies and plugins.运行以下命令输出大部分(但不是全部)依赖项和插件。

gradlew dependencies > dependency-tree.txt

Specify SonarQube plugin within build.gradle build.gradle内指定build.gradle插件

plugins {
  id 'org.sonarqube' version '3.2.0'
}

Specify SonarQube plugin within settings.gradlesettings.gradle指定 SonarQube 插件。gradle

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.2.0"
  }
}

apply plugin: "org.sonarqube" // set in build.gradle, not in settings.gradle

Results结果

Neither approach includes the org.sonarqube plugin in the dependency graph.这两种方法都没有在依赖图中包含org.sonarqube插件。 Is there a way to get this plugin to show up in the generated dependency tree?有没有办法让这个插件显示在生成的依赖树中? If yes, what changes need to be made?如果是,需要做出哪些改变?

The dependencies task provides the projet dependencies in each configuration, this does not include the projet script classpath (plugins). dependencies项任务在每个配置中提供项目依赖项,这不包括项目脚本类路径(插件)。

You have another similar task available, buildEnvironment (see BuildEnvironmentReportTask ) which will list the project build script dependencies.您还有另一个类似的任务可用, buildEnvironment (请参阅BuildEnvironmentReportTask ),它将列出项目构建脚本依赖项。 you could combine both tasks outputs if you need a aggredated report of all project/plugin dependencies如果您需要所有项目/插件依赖项的汇总报告,您可以合并两个任务输出

> Task :buildEnvironment

------------------------------------------------------------
Root project 'demo'
------------------------------------------------------------

classpath
\--- org.sonarqube:org.sonarqube.gradle.plugin:3.2.0
     \--- org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.2.0
          \--- org.sonarsource.scanner.api:sonar-scanner-api:2.16.1.361

A web-based, searchable dependency report is available by adding the --scan option.

BUILD SUCCESSFUL in 452ms

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM