fixed an issue with gradle 2.x compatibility

This fix works and is backwards compatible to gradle 1.x with one caveat: it must be built with the version of gradle that it is intended to be used for.  For the plugin to function with gradle 2.x, it needs to be built with gradle 2.x.  Similarly, it must be built with gradle 1.x to function with gradle 1.x.

Tested with gradle 2.1 and 1.11