LeftShift method has been deprecated in Gradle

I got a error when i run my project. I didn’t understand why?

Error:

The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_e5g21cu4bub6yuxffnr19u6q4$_run_closure8.doCall(K:\SuperSkill\Workspace\users\johnk\GitRoot\build.gradle:173)

build.gradle line 173:

task cleanConf(description: 'Cleans up conf directory') << {
  def dir = new File(cuba.tomcat.dir, '/conf/app-core')
  if (dir.isDirectory()) {
    ant.delete(includeemptydirs: true) {
      fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
    }
  }
}

Hello @jkarippery

Please wrap logs and snippets into code blocks via pair of triple backticks.

The problem is that “<< { … }” (leftShift) is a deprecated feature in Gradle. It is written in logs. You should replace it with the doLast operator in the following way:

task cleanConf(description: 'Cleans up conf directory') {
  doLast {
    def dir = new File(cuba.tomcat.dir, '/conf/app-core')
    if (dir.isDirectory()) {
      ant.delete(includeemptydirs: true) {
        fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
      }
    }
  }
}

Regards,
Daniil.

1 Like