Executing tasks with broken symlinks

My project (illustrated as below) has some ‘broken’ symlinks as placeholders intentionally.
However, in this case, gradle returns an error that could not list proper files.
I seek some good solutions for the problem (if possible I would like to keep using ‘broken’ symlinks, because that is very clear where files are located.)


  • project
    • subProject1
      • libs
        • subproject2_lib.jar -> …/…/subProject2/bin/subproject2_lib.jar
    • subProject2
      • bin
        • (Empty: subproject2_lib.jar will be generated through task “makeJar”)

subProject2 has a project with source codes that make "subproject2_lib.jar"
subProject1 requires the library that is generated in subProject2, which should be in “libs”

I tried these steps but gradle returned an error with ‘Could not list contents of …’

  • ‘project’ has a task “build”, which depends on “makeApp” and “makeJar”.
    • makeApp” must run after “makeJar
  • ‘subProject1’ has a task “makeApp
  • ‘subProject2’ has a task “makeJar