JDK9 and fatJar

(Martin Vseticka) #1


I use:

and my build.gradle contains:

// essentially taken from: http://stackoverflow.com/a/10986799/99256
task fatJar(type: Jar) {
    manifest.from jar.manifest
    classifier = 'all'
    from {
        configurations.compile.collect {
            it.isDirectory() ? it : zipTree(it)     // THIS LINE THROWS AN ERROR (SEE BELOW)
    } {
        exclude "META-INF/*.SF"
        exclude "META-INF/*.DSA"
        exclude "META-INF/*.RSA"

    with jar

I get the following error:

* What went wrong:
Could not determine the dependencies of task ':app:fatJar'.
> No signature of method: java.io.File.isDirectory() is applicable for argument types: () values: []

Does anyone know how to fix it? The build.gradle works in JDK8 (in and outside of Docker).

Thank you

EDIT: I posted the issue also here: http://stackoverflow.com/questions/42243683/how-to-create-fatjar-uberjar-with-gradle-and-jdk9