Home > Software engineering >  Gradle does not display all plugins in dependency tree
Gradle does not display all plugins in dependency tree

Time:11-11

I am trying to generate a dependency tree containing all plugins and dependencies for all configurations. I am working with a basic, single-module project and am using Gradle v7.5.1.

Running the following command outputs most (but not all) dependencies and plugins.

gradlew dependencies > dependency-tree.txt

However, the org.sonarqube plugin is missing. I've tried including a reference to this plugin in the build.gradle file by using...

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

And also tried the following in settings.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

But neither approach worked.

Is there a way to get this plugin to show up in the generated dependency tree? If yes, what changes need to be made?

CodePudding user response:

The dependencies task provides the projet dependencies in each configuration, this does not include the projet script classpath (plugins).

You have another similar task available, buildEnvironment (see BuildEnvironmentReportTask) which will list the project build script dependencies. 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

  • Related