# Detecting gradle version from a plugin

**URL:** <https://discuss.gradle.org/t/detecting-gradle-version-from-a-plugin/3188>\
**Category:** Old Forum Archive\
**Created:** [November 1, 2011, 6:44pm UTC](https://discuss.gradle.org/t/detecting-gradle-version-from-a-plugin/3188 "2011-11-01T18:44:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![phil\_swenson](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@phil\_swenson](https://discuss.gradle.org/u/phil_swenson)\
**Post date:** [November 1, 2011, 6:44pm UTC](https://discuss.gradle.org/t/detecting-gradle-version-from-a-plugin/3188/1 "2011-11-01T18:44:00Z")

</div>

I would like the ability to throw an exception if my gradle plugin doesn’t align with the expected gradle version (for example, my plugin currently only works on gradle 1.0 m3, it fails on m5).

Any thoughts on this? How do I detect the current gradle version?

---

<div class="post-metadata">

**Author:** ![Andrew\_Oberstar](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@Andrew\_Oberstar](https://discuss.gradle.org/u/Andrew_Oberstar)\
**Post date:** [November 2, 2011, 12:47pm UTC](https://discuss.gradle.org/t/detecting-gradle-version-from-a-plugin/3188/2 "2011-11-02T12:47:00Z")

</div>

```gradle
project.gradle.gradleVersion

```
