Kevin Loveland
12/21/2024, 1:19 AMruntimeClasspath
configuration? Iām trying to find a transitive dependency that is causing a problem and generating a flat list of dependency would be a great help. With the help of Google, I can find outdated/Groovy ways of declaring a task, but none of these solutions seem to work.Kevin Loveland
12/21/2024, 1:31 AMtasks.register("getDependencies") {
doLast {
project.configurations.filter { it.name == "runtimeClasspath" }.map { config ->
config.resolve()
.map { it.name }
.sorted()
.forEach { println(it) }
}
}
}
Shannon
12/21/2024, 1:35 AMdepencencies
(list all dependencies) or dependencyInsight
(find where a specific dependency comes from) tasks. Both accept options for the configuration to filter down to.
Another option is always a Gradle Build Scan.Kevin Loveland
12/21/2024, 1:36 AMShannon
12/21/2024, 1:37 AMdependencyInsight
task with the configuration filter then. It'll show you all of the paths from which the specified dependency comes from.Kevin Loveland
12/21/2024, 1:39 AMdependencyInsight
. The first step was the problem. Once I identified the artifact (which was an internal one), I saw the problem and now can identify why the wrong version is getting pulled in using dependencyInsight
šShannon
12/21/2024, 1:41 AMVampire
12/21/2024, 6:36 PMconfigurations
.runtimeClasspath
.files
*.name
.sort()
.forEach { println(it) }
Vampire
12/21/2024, 6:36 PMKevin Loveland
12/23/2024, 1:48 AMVampire
12/23/2024, 4:19 PMconfigurations
.runtimeClasspath
.get()
.files
.map { it.name }
.sorted()
.forEach { println(it) }
Or if you don't have the type-safe accessor
configurations["runtimeClasspath"]
.files
.map { it.name }
.sorted()
.forEach { println(it) }