3

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 ?

Vic Seedoubleyew
  • 9,888
  • 6
  • 55
  • 76

2 Answers2

3

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
Vic Seedoubleyew
  • 9,888
  • 6
  • 55
  • 76
2

In my case, seting defaultOutputDir was not enough. So I did the following:

eclipse {
     classpath {
        defaultOutputDir = file("build")
        file.whenMerged {
            entries.each { entry ->
                if (entry.kind == 'src' && entry.hasProperty('output')) {
                    entry.output = entry.output.replace('bin/', "build/")
                }
            }
        }
    }
}
Dimitar II
  • 2,299
  • 32
  • 33