Currently I have a plugin that needs to be backwards compatible when used as a library to groovy 2.0.2 . I still want the plugin to provide gradle tasks for gradle 2.1 if it is included as a buildscript. Is there a way to do this. Atm my groovy version is getting forced to 2.3
You can’t do this. However, Groovy is backwards binary compatible, at least within a major version. Compiling the code with 2.3 won’t exclude it from being used in 2.0.2. You just have to make sure not to use API that was introduced in a later version.
The other option is to compile the non Gradle parts as a separate library, with whatever Groovy version you want, and have your Gradle plugin depend on it.