# Eclipse ignores outputDir

**URL:** <https://discuss.gradle.org/t/eclipse-ignores-outputdir/29955>\
**Category:** Help/Discuss\
**Tags:** eclipse\
**Created:** [December 21, 2018, 1:03pm UTC](https://discuss.gradle.org/t/eclipse-ignores-outputdir/29955 "2018-12-21T13:03:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris\_s](https://avatars.discourse-cdn.com/v4/letter/c/d2c977/32.png) [@chris\_s](https://discuss.gradle.org/u/chris_s)\
**Post date:** [December 21, 2018, 1:03pm UTC](https://discuss.gradle.org/t/eclipse-ignores-outputdir/29955/1 "2018-12-21T13:03:09Z")

</div>

I’m tearing my hair out trying to get the eclipse integration to accept a class output directory separate from “bin/main” in my Java proect, but it completely ignores whatever I tell it. I’ve tried changing the source sets in any way I can think of. I’ve played with the defaultOutputDir of the eclipse task, but it is simply refusing to generate a .classpath with anything except the default dir. And “bin” is used for something else in our project, so it is not possible to use that one…

Why is it flat-out ignoring “outputdir” from below when generating the .classpath for eclipse?

sourceSets {  
main {  
java {  
srcDirs ‘source’  
outputDir = file(‘foobar’)  
}  
}  
}

Similarly, if I add the following, it still sets up “bin/main”  
eclipse {  
defaultOutputDir = file(‘foobar’)  
}

I’ve read the API documentation back and forth on the eclipse tasks as well as the SourceSet-related classes, and I don’t see any way to do this. Isn’t it possible to generate a .classpath with anything except the bin/-prefix?

Note: using gradle-5.0.

Edit: I seem to be able to overwrite the “bin” paths with the code supplied in the answer on this post: [https://stackoverflow.com/questions/17451567/splitting-main-and-test-in-gradles-eclipse-builds](https://stackoverflow.com/questions/17451567/splitting-main-and-test-in-gradles-eclipse-builds)  
But is that really the only way to change the output directories? It seems quite complicated for such an easy thing.

---

<div class="post-metadata">

**Author:** ![mtripakis](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mtripakis](https://discuss.gradle.org/u/mtripakis)\
**Post date:** [December 30, 2018, 11:06pm UTC](https://discuss.gradle.org/t/eclipse-ignores-outputdir/29955/2 "2018-12-30T23:06:55Z")

</div>

If you still haven’t found a solution, you can try to manipulate the .classpath file directly.

- Solution 1  
eclipse { classpath { file { whenMerged {  
def specialSource = entries.find { it.path =“sourceFolder” }  
specialSource .setOutput(“outputRelativePath”)  
}}}}

- Solution 2  
eclipse { classpath { file { whenMerged {  
def specialSource = new org.gradle.plugins.ide.eclipse.model.SourceFolder(“sourceFolder”,“outputRelativePath”)  
entries += specialSource  
}}}}

(In solution 2 you use the [second constructor](https://docs.gradle.org/current/javadoc/org/gradle/plugins/ide/eclipse/model/SourceFolder.html#constructor.summary) for a new classpath entry and directly create one (entry) of: kind=“src”, output = “outputRelativePath” and path = “sourceFolder”. Afterwards, you can add any other desired attributes. This [worked for me](https://discuss.gradle.org/t/buildship-how-to-ignore-optional-problems-in-annotation-apt-generated-classes/29749/2) when I was trying to add a certain attribute to an output folder)
