# buildSrc build is not cleared after build

**URL:** https://discuss.gradle.org/t/buildsrc-build-is-not-cleared-after-build/1572
**Category:** Old Forum Archive
**Created:** [November 18, 2014, 9:31pm UTC](https://discuss.gradle.org/t/buildsrc-build-is-not-cleared-after-build/1572 "2014-11-18T21:31:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Yohan\_Hartanto](https://avatars.discourse-cdn.com/v4/letter/y/f14d63/32.png) [@Yohan\_Hartanto](https://discuss.gradle.org/u/Yohan_Hartanto)
#### Post date: [November 18, 2014, 9:31pm UTC](https://discuss.gradle.org/t/buildsrc-build-is-not-cleared-after-build/1572/1 "2014-11-18T21:31:00Z")

</div>

We are using gradle 2.1 and deleting files in buildSrc can cause subsequent build to fail.

The scenario is: 1. Add groovy and groovy test to buildSrc 2. run assemble (we are using android) 3. Delete the test files 4. run assemble again. 5. Notice buildSrc:test will still be run again even though there is no test anymore.

The workaround is to manually remove buildSrc/build folder

---

<div class="post-metadata">

### Author: ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)
#### Post date: [November 18, 2014, 9:37pm UTC](https://discuss.gradle.org/t/buildsrc-build-is-not-cleared-after-build/1572/2 "2014-11-18T21:37:00Z")

</div>

This should only ever happen if _all_ test files are deleted. It’s a known limitation of compile tasks that’s not specific to ‘buildSrc’, except that it’s harder to clean ‘buildSrc’ (as ‘gradle clean’ won’t help).

---

<div class="post-metadata">

### Author: ![Yohan\_Hartanto](https://avatars.discourse-cdn.com/v4/letter/y/f14d63/32.png) [@Yohan\_Hartanto](https://discuss.gradle.org/u/Yohan_Hartanto)
#### Post date: [December 4, 2014, 10:39pm UTC](https://discuss.gradle.org/t/buildsrc-build-is-not-cleared-after-build/1572/3 "2014-12-04T22:39:00Z")

</div>

I think there should be a task created to clean buildSrc. e.g. .gradlew cleanBuildSrc that deletes the buildSrc/build folder and cleanAll will run clean and cleanBuildSrc.
