Eclipse project generation

I am working with a project which is configured with Gradle. There is a build.gradle and the associated gradlew scripts in the parent directory and each of ~25 subdirectories (with the code for a different Java library within the project) contains a separate build.gradle.

I would like to generate the Eclipse project files for all of these projects. I can successfully do this by adding “apply plugin: ‘eclipse’” to the end of each of the build.gradle files and then running “./gradlew eclipse”.

However, I would like to avoid having to edit all of the build.gradle files, because this is not my code. I will be submitting pull requests which change the build.gradle files in other ways, and my choice of IDE is irrelevant to the project. So I will need to:

  • Edit all of the build.gradle files to generate the Eclipse projects
  • Do development which changes the build.gradle files
  • Edit out all of the Eclipse-specific stuff from the build.gradle files before committing the code so as not to pollute the codebase

Is it possible to enable the eclipse plugin via the command line, a development-environment-specific config file, or some other method?

not sure about your usecase, butyou could just put the following code on the root projejcts build.gradle file:

allprojects { apply plugin:'ecilpse' }

if that is not an option for you you can use an init script to inject logic into the executing build. have a look at the gradle userguide about init scripts at https://docs.gradle.org/current/userguide/init_scripts.html

cheers,
René