javagradlebuilduberjar

Could not determine the dependencies of task ':fatJar'


FAILURE: Build failed with an exception.

* Where:
Build file 'C:\ForgeMods\MyFirstGradleProject\build.gradle' line: 57

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

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s

When Im Trying to run 'gradlew fatJar' this error has always appears. Im trying to create an executable jar file with dependencies

jar {
    manifest {
        attributes 'Main-Class': 'gradle.Main'
    }
    from {
        configurations.runtimeClasspath.collect { it.IsDirectory() ? it : zipTree(it) }
    }
}

task fatJar(type: Jar) {
  manifest {
    attributes 'Main-Class': 'gradle.Main'
  }
  archiveClassifier = "all"
  from {
    configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    configurations.runtimeClasspath.collect { it.IsDirectory() ? it : zipTree(it) }
    }
  with jar
}

I tried to google it, but I found nothing


Solution

  • Try it.isDirectory() rather than it.IsDirectory().

    Of your three calls to the method in your code, two are the incorrect version.