Vic Seedoubleyew
Vic Seedoubleyew

Reputation: 10536

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 ?

Upvotes: 3

Views: 4406

Answers (2)

Dimitar II
Dimitar II

Reputation: 2519

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/")
                }
            }
        }
    }
}

Upvotes: 2

Vic Seedoubleyew
Vic Seedoubleyew

Reputation: 10536

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

Upvotes: 3

Related Questions