How can I copy dependencies, but exclude all of the files in a particular directory?

I found an earlier post in the old forum: Old Post

This is a good solution, but I have a slightly different problem:

I’m writing a plugin with java and building with Gradle. As it usually goes with plugins, you have a client library to build against, but that code is already in the host application. So when you actually deploy, you don’t need those in your deployed plugin. However, you need all of the rest of your dependencies to make your plugin work.

I’d like to say:

task copyPluginLibs(type: Copy) {
    into "lib"
    from configurations.runtime - <<contents of lib directory>>
}

Can this be done?
Thanks!

1 Like