Creating .project and .classpath files for eclipse

In our project structure we have the following files

.project.org .classpath.org

We want to write a task to copy them in the same directory to .project .classpath

after some search we found the following solution

task eclipcify(type: Copy) {
 outputs.files.setFrom(file("$projectDir/Makefile"))
  from '.'
  into projectDir
  include '.*.org'
   rename ('.project.org', '.project')
   rename ('.classpath.org', '.classpath')
}

it works fine for the very first time, but does not work from the 2nd execution, say if we delete .classpath and .project files and rerun the task the files are not created.

we have to again delete .grade folder to get it working again, but that is not the solution.

we are working on Windows Machine.

Is your project a Java project? If so, you can use the ‘eclipse’ plug-in to generate the .classpath and .project files from your build.gradle dependencies.

e.g., it would look something like (build.gradle):

apply plugin: 'eclipse'

And then you’d be able to run ‘gradle eclipse’ to get your .classpath and .project files.

Your ‘eclipcify’ task sets the list of output files Gradle checks when determining if a task should re-run to projectDir/Makefile. Did you want to make eclipcify run if Makefile changes? If you remove that line, does that fix your problem?