Modify sourceSets from Gradle Plugin

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?

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

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 :)

Amazing! Thank you so much! Hope you have an amazing day :slight_smile:

@SvenWollinger you very welcome and thanks a lot :slight_smile:

1 Like