Quantcast
Viewing all articles
Browse latest Browse all 174

GRADLE: How to copy files from another .jar into your resulting output .jar

In our project we like to deliver a single jar as the final product, if you need to copy files that live on an existing jar into the Gradle’s output jar, this example shows you how to do that (and more)

jar {
    //this is how you change the name of the output jar
    archiveName='frostwire.jar'

    //some exclusion rules to keep your .jar clean
    exclude('META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF')

    //here we grab all the .class files inside messages.jar and we put them in our resulting jar
    from (zipTree('lib/jars/messages.jar')) {
        include '**/*.class'
    }

    //how to manipulate the jar's manifest
    manifest {
        attributes 'Main-Class': 'com.limegroup.gnutella.gui.Main'
    }
}

Viewing all articles
Browse latest Browse all 174

Trending Articles