Is there a way to get local copies of all jars tha...
# gradle
k
Is there a way to get local copies of all jars that are runtime dependencies of a multi-module project? In "traditional" gradle world I use a
Copy
task with
subprojects.findAll { /* some condition */ }.collect { it.configurations.compileClasspath }
But I can't seem to find the equivalent of
compileClasspath
for kotlin modules in
build.gradle.kts
world
And you probably want
runtimeClasspath
the compile one also has compileOnly dependencies and won't include some transitive dependencies
k
Copy code
println(configurations.getByName("compileClasspath").map { file: File -> file.name })
gives me
Resolving dependency configuration 'compileClasspath' is not allowed as it is defined as 'canBeResolved=false'
Copy code
println(configurations.getByName("runtimeClasspath").map { file: File -> file.name })
gives me
Configuration with name 'runtimeClasspath' not found.
And with this:
Copy code
tasks.register("getDependencies") {
    subprojects {
        println("For ${project.name}")
        val myCompileClasspath by configurations.creating {
            extendsFrom(configurations["compileClasspath"])
            isCanBeResolved = true
            isCanBeConsumed = false
        }

        println(myCompileClasspath.map { file: File -> file.name })
    }
}
message has been deleted
Which might be something specific to compose-desktop, maybe
r
Why are you using
compileClasspath
rather than
runtimeClasspath
, if you want “all jars that are runtime dependencies”? FWIW this is currently working for me in a plugin project:
Copy code
val project: Project = TODO()
val runtimeClasspath: Provider<Configuration> = project.configurations.named("runtimeClasspath")
k
This is not working for me on a real multi-module project. It says
Configuration with name 'runtimeClasspath' not found.
113 Views