# Deprecation of configureForSourceSet

**URL:** <https://discuss.gradle.org/t/deprecation-of-configureforsourceset/24757>\
**Category:** Help/Discuss\
**Created:** [November 13, 2017, 10:55am UTC](https://discuss.gradle.org/t/deprecation-of-configureforsourceset/24757 "2017-11-13T10:55:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Schalk\_Cronje](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/schalk_cronje/32/6511_2.png) [@Schalk\_Cronje](https://discuss.gradle.org/u/Schalk_Cronje)\
**Post date:** [November 13, 2017, 10:55am UTC](https://discuss.gradle.org/t/deprecation-of-configureforsourceset/24757/1 "2017-11-13T10:55:34Z")

</div>

I have noted the following deprecation message introduced  
in 4.0, however not mentioned in the release notes.

_The configureForSourceSet(SourceSet, AbstractCompile) method has been deprecated and is scheduled to be removed in Gradle 5.0._

The method in question is [https://docs.gradle.org/current/javadoc/org/gradle/api/plugins/JavaBasePlugin.html#configureForSourceSet(org.gradle.api.tasks.SourceSet,%20org.gradle.api.tasks.compile.AbstractCompile)](https://docs.gradle.org/current/javadoc/org/gradle/api/plugins/JavaBasePlugin.html#configureForSourceSet(org.gradle.api.tasks.SourceSet,%20org.gradle.api.tasks.compile.AbstractCompile)) and I suspect are used in a number of third-party language plugins. This is probably not a trivial migration to those maintainers.

What is the new appraoch here? Are there better APIs available since 4.0 for implementing JVM language plugins?

---

<div class="post-metadata">

**Author:** ![Schalk\_Cronje](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/schalk_cronje/32/6511_2.png) [@Schalk\_Cronje](https://discuss.gradle.org/u/Schalk_Cronje)\
**Post date:** [November 13, 2017, 2:29pm UTC](https://discuss.gradle.org/t/deprecation-of-configureforsourceset/24757/2 "2017-11-13T14:29:31Z")

</div>

From looking at the Gradle source, usage of `configureForSourceSet` has been replaced by calling an internal API `SourceSetUtils.configureForSourceSet`. This is not a feasible solution for plugin developers.

---

<div class="post-metadata">

**Author:** ![deanhiller](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/deanhiller/32/5516_2.png) [@deanhiller](https://discuss.gradle.org/u/deanhiller)\
**Post date:** [April 10, 2019, 2:56am UTC](https://discuss.gradle.org/t/deprecation-of-configureforsourceset/24757/3 "2019-04-10T02:56:58Z")

</div>

has this been fixed? I have a plugin I need to upgrade and no idea how to do it and it uses that method too?

thanks,  
Dean

---

<div class="post-metadata">

**Author:** ![deanhiller](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/deanhiller/32/5516_2.png) [@deanhiller](https://discuss.gradle.org/u/deanhiller)\
**Post date:** [April 10, 2019, 3:02am UTC](https://discuss.gradle.org/t/deprecation-of-configureforsourceset/24757/4 "2019-04-10T03:02:26Z")

</div>

> [@Schalk\_Cronje](#):
>
> replaced by calling an internal API `SourceSetUtils.configureForSourceSet` . This is not a feasible solution for plugin de

oh, I am on https://services.gradle.org/distributions/gradle-4.8.1-bin.zip release so not sure if I need to be on a certain release where there is a public method I can use before the upgrade to 5.0?

I need to get it working before 5.0 or end up in a circular issue since my build uses the plugin it also creates…lol…sort of like eating my own medicine BUT it causes issues were I need replacements exposed before the previous methods are removed.

---

<div class="post-metadata">

**Author:** ![Schalk\_Cronje](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/schalk_cronje/32/6511_2.png) [@Schalk\_Cronje](https://discuss.gradle.org/u/Schalk_Cronje)\
**Post date:** [April 10, 2019, 11:07am UTC](https://discuss.gradle.org/t/deprecation-of-configureforsourceset/24757/5 "2019-04-10T11:07:10Z")

</div>

It definitely has been removed.

AFAIK you know have to resort to doing more work yourself. Firstly by calling

```groovy
project.convention.getPlugin(JavaPluginConvention).sourceSets.all { SourceSet sourceSet ->
   // ...
}

```

Look at the `subprojects//plugins/src/main/java/org/gradle/api/plugins/GroovyBasePlugin.java` file in the Gradle repository for some (de)motivation.

---

<div class="post-metadata">

**Author:** ![deanhiller](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/deanhiller/32/5516_2.png) [@deanhiller](https://discuss.gradle.org/u/deanhiller)\
**Post date:** [April 27, 2019, 9:31pm UTC](https://discuss.gradle.org/t/deprecation-of-configureforsourceset/24757/6 "2019-04-27T21:31:18Z")

</div>

thanks, basically copied over all that code and it worked like a charm.
