gradlegradle-eclipse

How to set Eclipse's output directory from Gradle


I am using Gradle's eclipse plugin. For cross-project reference reasons, I need Eclipse's output directory to not be the default bin, rather ecbuild.

Everytime I run ./gradlew eclipse, it overwrites this output directory setting.

How to make sure it doesn't, or how to set it within gradle build script ?


Solution

  • Add this to the build.gradle script:

    eclipse {
       classpath { defaultOutputDir = file('ecbuild') }
    }
    

    This might require you to upgrade the version of your gradle wrapper.

    If so, run :

    ./gradlew wrapper --gradle-version 3.3