With Gradle 6 I used following snippet to collect all dependencies in my project (using project.configurations.runtime
) and copy them to a folder "$buildDir/libs"
.
tasks.register<Copy>("copyDependenciesToLib") {
into("$buildDir/libs")
from(project.configurations.runtime)
doLast {
println("copyDependenciesToLib:\n ${project.configurations.runtime.get().files.joinToString("\n ") { it.absolutePath }}\n ->\n $buildDir/libs")
}
}
I am currently migrating to Gradle 7, and IntelliJ tells me that runtime
cannot be resolved, it seems that it has been removed from configuration
?
Can you point me in the right direction to reproduce the behavior of the above script in Gradle 7?
I just found the answer myself.
A similar question has been asked here.
Gradle has removed the runtime configuration in Gradle 7.
Instead, one can use runtimeClasspath
.
Our copy
task now looks the following:
tasks.register<Copy>("copyDependenciesToLib") {
into("$buildDir/libs")
from(project.configurations.runtimeClasspath)
doLast {
println("copyDependenciesToLib:\n ${project.configurations.runtimeClasspath.get().files.joinToString("\n ") { it.absolutePath }}\n ->\n $buildDir/libs")
}
}