Determine origin of gradle plugin

I have a Kotlin + Spring Boot project with multiple projects (therefore, multiple build.gradle files). One particular build.gradle file contains the following:

plugins {
    id('kotlin-kapt')
}

I would like to figure out where this kotlin-kapt dependency is coming from. I mean, there has to be something specified within a dependency {} block or so that’s required for kotlin-kapt to be resolved successfully. What is the most efficient way to figure this out? Is there maybe a gradle command to show such dependencies?

What I’ve tried already is to execute the following gradle command:

./gradlew :my-project:my-subproject:dependencies

The output includes something like the following:

kapt
\--- org.hibernate:hibernate-jpamodelgen:x.x.x.Final
     +--- org.jboss.logging:jboss-logging:x.x.x.Final
     +--- javax.xml.bind:jaxb-api:x.x.x
     |    \--- javax.activation:javax.activation-api:x.x.x
     \--- org.glassfish.jaxb:jaxb-runtime:x.x.x
          +--- javax.xml.bind:jaxb-api:x.x.x (*)
          +--- org.glassfish.jaxb:txwx:x.x.x
         [… more]
          \--- javax.activation:javax.activation-api:x.x.x

but I don’t think this really tells me where kotlin-kapt is coming from, because I don’t expect hibernate-jpamodelgen to include kapt. The relation is probably more in the other direction, in the sense that the kapt annotation processor is applied to jpamodelgen.

Any help is appreciated!

Don’t confuse project dependencies and build script / plugin dependencies.
What you investigate and talk about are project dependencies and yes, what you display is what is used during kapt execution.

The task you are after is buildEnvironment, not dependencies, as that shows exactly those dependencies.
But no, you usually do not explicitly depend on such plugins.
To start with, kotlin-kapt is deprecated and you should use org.jetbrains.kotlin.kapt.
And then, if you would have id('org.jetbrains.kotlin.kapt') version 'xxx', it would be resolved through the marker artifact that is org.jetbrains.kotlin.kapt:org.jetbrains.kotlin.kapt.gradle.plugin:xxx from the configured plugin repositories in the settings script.
As you just have an ID without version, that means the plugin is already on the classpath, probably because you have the Kotlin Gradle plugin already applied or added to the classpath of :my-project:my-subproject, :my-project, or :.

1 Like