This message was deleted.
# plugin-development
s
This message was deleted.
v
Built-in plugins like
checkstyle
provide you a
toolVersion
property on their extension and use it to create default dependencies. So you can either define the tool version property and get the right default dependencies, or if you add your own dependencies to that configuration need to make sure to add all necessary dependencies. This for example also mitigates cases where artifact coordinates change in the future.
a
You could consider creating two Plugins. • One would be a 'base' plugin that would set up the ground work, for example it would register the Configurations. • And another would be more opinionated, and add default dependencies. If someone really wanted to set up the dependencies manually then they could use the basic base plugin. But most users would use the opinionated plugin. But this could make things a lot more complicated! If your plugin doesn't need it, then I think your current approach is fine.
v
But what you describe is exactly what default dependencies are for, no need for a plugin split.
k
It's complicated by the fact that my configuration has three default dependencies, but I suppose that based on the precedent, it's an acceptable tradeoff wrt default dependencies that way.
👌 1
v
Actually, I had another related topic. You can actually add to the default dependencies instead of replacing them if you want.
As soon as you add a dependency normally, all default dependencies are not used and you need to provide every necessary dependency explicitly.
But there is a late hook for last-minute dependency additions, and that is evaluated after the default dependencies being added.
So with
Copy code
configurations {
    yourConfiguration {
        withDependencies {
            add(project.dependencies.create("of.of:the.default.dependencies:1.2.3"))
        }
    }
}
you can add to the default dependencies for example without loosing them.
k
Aside from the inherent clunkiness (which to be fair I might put less value into compared to my users), I'm sold.