Configuration.files does not work after upgrading from 4.5.1 to 5.2.1

We had this task in version 4.5.1:

task copyRuntimeLibs(type: Copy) {
    from configurations.runtimeClasspath.files
    into 'test_lib'

When I tried upgrading to 5.2.1 it failed with:

* What went wrong:
A problem occurred evaluating project ':common'.
> Could not resolve all dependencies for configuration ':common:runtimeClasspath'.
   > Cannot cast org.gradle.api.DefaultTask_Decorated to org.gradle.language.jvm.tasks.ProcessResources

Why is this?

I’m pretty new to Groovy and Gradle but from what I can tell configurations.runtimeClasspath is a Configuration which is a FileCollection that has a method getFiles(). This all looks the same between 5.2.1 and 4.5.1.