Why can't gradle have a "lite" plugin?

I hope this doesn’t sound too silly, but. . . In terms of a set of custom tasks, why wouldn’t it be possible to just bundle your custom tasks into a JAR, add them to the dependencies of a project and call it done?

I have a pretty simple third party command line tool that makes REST calls and returns JSON. To make it more convenient, I wrapped this in a mini-library which practically mirrors that command line tool. I didn’t feel too good about that violation of DRY but I couldn’t think of an alternative. Keeping this first level of wrapper is somewhat important because it’s a set of POJOs that more easily integrate the third party tool in different contexts.

Now I want to make that new wrapper accessible to my build script and it seems like I have to wrap it again by a custom task class. Then, since I want the functionality to be easily managed across projects I need wrap it again in the plugin.

As I go through the various coding to make the arguments available via plugin extensions, etc, I’m just feeling very uneasy like this isn’t a good approach.

I guess it’s basically one extra level of wrapping than ant would require. Do I have that right?

If you add your jar to the build classpath you can reuse your tasks.

buildscript {
    dependencies {
        classpath 'com.mycompany:mytasks:1.0.0'
    }
}

You only need to write a plugin if you want to have a plugin-level configuration and configure default tasks by convention. Even in that case, you still get to reuse your tasks.

Ahhhh, ha! That’s awesome, I didn’t realize that though I always thought such should be the case. Thank you for that!