Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 19870

How to copy a folder from a dependent External Library's jar into the gradle project's jar?

$
0
0

Hi @90abyss,

You can use zipTree() to work with the content of the jar rather than the jar file itself. Here is a complete example taking a jar from the classpath and packaging its content into your jar:

plugins {
    id 'java-library'
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.apache.commons:commons-lang3:3.9'
}

jar {
    from provider {
        zipTree(configurations.compileClasspath.filter {
            it.name == 'commons-lang3-3.9.jar'
        }.singleFile)
    }
}

Viewing all articles
Browse latest Browse all 19870

Trending Articles