# How to tell Eclipse not use my custom sourceSets

**URL:** https://discuss.gradle.org/t/how-to-tell-eclipse-not-use-my-custom-sourcesets/8756
**Category:** Help/Discuss
**Tags:** eclipse
**Created:** [April 9, 2015, 1:43am UTC](https://discuss.gradle.org/t/how-to-tell-eclipse-not-use-my-custom-sourcesets/8756 "2015-04-09T01:43:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mickyp](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mickyp/32/2060_2.png) [@mickyp](https://discuss.gradle.org/u/mickyp)
#### Post date: [April 9, 2015, 1:43am UTC](https://discuss.gradle.org/t/how-to-tell-eclipse-not-use-my-custom-sourcesets/8756/1 "2015-04-09T01:43:46Z")

</div>

I need to export api and impl to different jar, so I need to custom my sourceSets to the following:

```
sourceSets{
	
	api {
		java {
			srcDir "src/main/java"
			include "com/my/api/**"
			exclude "com/my/api/impl/**"
		}
	}
	
	core {
		java {
			srcDir "src/main/java"
			exclude "com/my/api/*.java"
			exclude "com/my/api/model/**"
		}
		resources {
			srcDir "src/main/resources"
			exclude "**/package-info.java"
		}
		
		compileClasspath = sourceSets.main.output + configurations.compile
	}
}

```

Notice that I don’t have main.java.srcDir settings.  
When I make this to eclipse project, gradle generates lots source folder in classpath as following:

```
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry including="com/my/api/ **" excluding="com/my/api/impl/**" kind="src" path="src/main/java"/>
<classpathentry excluding="com/my/api/*.java|com/my/api/model/**" kind="src" path="src/main/java"/>
<classpathentry excluding="**/package-info.java" kind="src" path="src/main/resources"/>

```

It’s fine that gradle create four classpath for me about maven/gradle convention: “src/main/java”, “src/main/resources”, “src/test/java”, and “src/test/resources”.  
But I don’t want the other classpath entries in the last three rows about my setting in sourceSets.

I want to know how to tell Eclipse not use my custom sourceSets, or how to set the correct sourceSets, or any one can tell me any other suggestions?!

Thank you.

---

<div class="post-metadata">

### Author: ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)
#### Post date: [April 9, 2015, 10:05am UTC](https://discuss.gradle.org/t/how-to-tell-eclipse-not-use-my-custom-sourcesets/8756/2 "2015-04-09T10:05:58Z")

</div>

you can exclude sourceSets from your eclipse setup using the following snippet:

```
eclipse {
    classpath {
        sourceSets -= [sourceSets.api, sourceSets.core]	
    }	
 }

```

you might want to consider to use the `java-base` plugin and get rid of the `main` and the `test` sourceSet as you don’t really use them.

---

<div class="post-metadata">

### Author: ![mickyp](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mickyp/32/2060_2.png) [@mickyp](https://discuss.gradle.org/u/mickyp)
#### Post date: [April 10, 2015, 5:24am UTC](https://discuss.gradle.org/t/how-to-tell-eclipse-not-use-my-custom-sourcesets/8756/3 "2015-04-10T05:24:59Z")

</div>

Great! It works.

Thank you very much 🙂
