I am new to gradle but learning quickly. I need to get some specific JARs from logback into a new directory in my release task. The dependencies are resolving OK, but I ca
It is worth nothing that the accepted answer filters the Configuration
as a FileCollection
so within the collection you can only access the attributes of a file. If you want to filter on the dependency itself (on group, name, or version) rather than its filename in the cache then you can use something like:
task copyToLib(type: Copy) {
from findJarsByGroup(configurations.compile, 'org.apache.avro')
into "$buildSrc/lib"
}
def findJarsByGroup(Configuration config, groupName) {
configurations.compile.files { it.group.equals(groupName) }
}
files
takes a dependencySpecClosure which is just a filter function on a Dependency
, see: https://gradle.org/docs/current/javadoc/org/gradle/api/artifacts/Dependency.html