# How to write a custom build step

**URL:** <https://discuss.gradle.org/t/how-to-write-a-custom-build-step/41273>\
**Category:** Help/Discuss\
**Created:** [October 26, 2021, 6:03pm UTC](https://discuss.gradle.org/t/how-to-write-a-custom-build-step/41273 "2021-10-26T18:03:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexspurling](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@alexspurling](https://discuss.gradle.org/u/alexspurling)\
**Post date:** [October 26, 2021, 6:03pm UTC](https://discuss.gradle.org/t/how-to-write-a-custom-build-step/41273/1 "2021-10-26T18:03:15Z")

</div>

I would like to write a custom step in our build that validates the filenames of a set of files in one of the source code directories. If the files are invalid then the build should fail. This custom step is specific to a single project and won’t be needed in other projects. What is the best way to do this? Should I write a custom plugin, should I write a custom task? Should I write the step directly into the build.gradle file of my project?

---

<div class="post-metadata">

**Author:** ![imrichardcole](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@imrichardcole](https://discuss.gradle.org/u/imrichardcole)\
**Post date:** [September 12, 2022, 5:09pm UTC](https://discuss.gradle.org/t/how-to-write-a-custom-build-step/41273/2 "2022-09-12T17:09:39Z")

</div>

Hi - to better help, could you please give and idea of the file and directory structures please?

Based on what you’ve said, if it’s not used across projects, a plugin feels like overkill.
