Copying files no signature of method not found

Hi,
I have a task like this:

task buildDocker(type: Docker, dependsOn: build) {
  push = false
  applicationName = jar.baseName
  dockerfile = file('./docs/docker/Dockerfile')
  doFirst {
  copy {
       from 'build/libs/myapp.jar'
       to 'docs/docker'
  }
  }
}

I get this error when I do a gradle buildDocker

Execution failed for task ':buildDocker'.
> No signature of method: org.gradle.api.internal.file.copy.CopySpecWrapper_Decorated.to() is applicable for argument types: (java.lang.String) values: [docs/docker]
  Possible solutions: into(java.lang.Object), is(java.lang.Object), any(), from([Ljava.lang.Object;), into(java.lang.Object, groovy.lang.Closure), with([Lorg.gradle.api.file.CopySpec;)

Did you consider changing ‘to’ to ‘into’?

That fixed it, thanks!

1 Like

Could you please tell me how you have fixed this issue becuase am also getting same kind issue

Error log :

Task :ranger-sdeb FAILED

FAILURE: Build failed with an exception.

  • Where:
    Script ‘/home/master/25_bigtop/bigtop/packages.gradle’ line: 400

  • What went wrong:
    Execution failed for task ‘:ranger-sdeb’.

No signature of method: org.gradle.api.internal.file.collections.DefaultConfigurableFileTree.copy() is applicable for argument types: (packages_1es8hw61buw7k26r8igpxeiox$_run_closure11$_closure27$_closure58) values: [packages_1es8hw61buw7k26r8igpxeiox$_run_closure11$_closure27$_closure58@4c1a692f]
Possible solutions: chop([I), sort(), any(), join(java.lang.String), any(groovy.lang.Closure), sort(groovy.lang.Closure)