# Modify sourceSets from Gradle Plugin

**URL:** https://discuss.gradle.org/t/modify-sourcesets-from-gradle-plugin/44101
**Category:** Help/Discuss
**Created:** [October 25, 2022, 7:02pm UTC](https://discuss.gradle.org/t/modify-sourcesets-from-gradle-plugin/44101 "2022-10-25T19:02:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![SvenWollinger](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@SvenWollinger](https://discuss.gradle.org/u/SvenWollinger)
#### Post date: [October 25, 2022, 7:02pm UTC](https://discuss.gradle.org/t/modify-sourcesets-from-gradle-plugin/44101/1 "2022-10-25T19:02:11Z")

</div>

Hi! So im writing a gradle plugin and id like to configure sourceSets.  
In my apply method i have the project instance, but i cannot seem to find any way to access the sourceSets from it.  
What is the intended way of doing so?

---

<div class="post-metadata">

### Author: ![justsomeone](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@justsomeone](https://discuss.gradle.org/u/justsomeone)
#### Post date: [October 25, 2022, 8:40pm UTC](https://discuss.gradle.org/t/modify-sourcesets-from-gradle-plugin/44101/2 "2022-10-25T20:40:11Z")

</div>

Hello @SvenWollinger

i am new to gradle so this what i find  
sourceSets is part of the java plugin so make sure your project has this plugin not sure if there other plugin offer that then

````gradle
getExtensions() // this will get you all extension applied to your project 
.findByType(JavaPluginExtension.class) // this will get the javaplugin extension for this project
.sourceSets // this will get you the sourceSets```

hope that help and have a nice day :)
````

---

<div class="post-metadata">

### Author: ![SvenWollinger](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@SvenWollinger](https://discuss.gradle.org/u/SvenWollinger)
#### Post date: [October 25, 2022, 9:02pm UTC](https://discuss.gradle.org/t/modify-sourcesets-from-gradle-plugin/44101/3 "2022-10-25T21:02:17Z")

</div>

Amazing! Thank you so much! Hope you have an amazing day 🙂

---

<div class="post-metadata">

### Author: ![justsomeone](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@justsomeone](https://discuss.gradle.org/u/justsomeone)
#### Post date: [October 26, 2022, 11:45am UTC](https://discuss.gradle.org/t/modify-sourcesets-from-gradle-plugin/44101/4 "2022-10-26T11:45:37Z")

</div>

@SvenWollinger you very welcome and thanks a lot 🙂
