# How to exclude checkstyle task from build task?

**URL:** <https://discuss.gradle.org/t/how-to-exclude-checkstyle-task-from-build-task/6692>\
**Category:** Old Forum Archive\
**Created:** [September 24, 2014, 4:42pm UTC](https://discuss.gradle.org/t/how-to-exclude-checkstyle-task-from-build-task/6692 "2014-09-24T16:42:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akshay\_Pitale](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Akshay\_Pitale](https://discuss.gradle.org/u/Akshay_Pitale)\
**Post date:** [September 24, 2014, 4:42pm UTC](https://discuss.gradle.org/t/how-to-exclude-checkstyle-task-from-build-task/6692/1 "2014-09-24T16:42:00Z")

</div>

I want to know how to change build task? I have checkstyle task and i want that to be get exclude from build task. As because of that my whole build is getting failed.

---

<div class="post-metadata">

**Author:** ![erdi](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/erdi/32/24_2.png) [@erdi](https://discuss.gradle.org/u/erdi)\
**Post date:** [September 25, 2014, 4:09am UTC](https://discuss.gradle.org/t/how-to-exclude-checkstyle-task-from-build-task/6692/2 "2014-09-25T04:09:00Z")

</div>

```gradle
gradle build -x checkstyleMain

```

---

<div class="post-metadata">

**Author:** ![Akshay\_Pitale](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Akshay\_Pitale](https://discuss.gradle.org/u/Akshay_Pitale)\
**Post date:** [September 25, 2014, 6:02am UTC](https://discuss.gradle.org/t/how-to-exclude-checkstyle-task-from-build-task/6692/3 "2014-09-25T06:02:00Z")

</div>

okay this is one way, How should i mention in build gradle file for skipping checkstyle task.

---

<div class="post-metadata">

**Author:** ![Perryn\_Fowler](https://avatars.discourse-cdn.com/v4/letter/p/82dd89/32.png) [@Perryn\_Fowler](https://discuss.gradle.org/u/Perryn_Fowler)\
**Post date:** [September 25, 2014, 6:49am UTC](https://discuss.gradle.org/t/how-to-exclude-checkstyle-task-from-build-task/6692/4 "2014-09-25T06:49:00Z")

</div>

There are a few ways - take a look at this chapter in the user guide: [http://www.gradle.org/docs/current/userguide/more\_about\_tasks.html](http://www.gradle.org/docs/current/userguide/more_about_tasks.html)

---

<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:** [September 25, 2014, 8:28am UTC](https://discuss.gradle.org/t/how-to-exclude-checkstyle-task-from-build-task/6692/5 "2014-09-25T08:28:00Z")

</div>

```gradle
checkstyle {
    sourceSets = []
}

```

Now Checkstyle tasks will only run when called explicitly from the command line or depended upon explicitly in the build script.

---

<div class="post-metadata">

**Author:** ![Akshay\_Pitale](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Akshay\_Pitale](https://discuss.gradle.org/u/Akshay_Pitale)\
**Post date:** [September 25, 2014, 2:50pm UTC](https://discuss.gradle.org/t/how-to-exclude-checkstyle-task-from-build-task/6692/6 "2014-09-25T14:50:00Z")

</div>

it worked…thank you so much (y)
