Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle fat jar _leaving out_ META-INF from child jars?

Tags:

gradle

Is there any way to leave out certain paths from a Gradle fat jar.

I am using:

jar {
    from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}

from

http://docs.codehaus.org/display/GRADLE/Cookbook

and would like to leave out META-INF directories if possible.

Thank you! Misha

like image 875
Миша Кошелев Avatar asked Jun 20 '10 22:06

Миша Кошелев


1 Answers

I haven't extensively tested it, but this should do what you're asking for:

jar {
    from configurations.compile.collect {
        it.isDirectory() ? it : zipTree(it).matching{exclude{it.name == 'META-INF'}}
    }
}
like image 64
TheKaptain Avatar answered Nov 05 '22 02:11

TheKaptain