How to include plugins that have the task with the same name?

Hi there!
Who knows, how to include plugins that have the task with the same name?
My example is:

plugins {

Both plugins provide the task with name “snapshot”. When I run any gradle task I’ve got an exception like this:

An exception occurred applying plugin request [id: ‘org.liquibase.gradle’, version: ‘2.0.4’]
Failed to apply plugin ‘org.liquibase.gradle’.
Cannot add task ‘snapshot’ as a task with that name already exists.

So, the question is how can I avoid this behavior?

Actually, I don’t need ‘snapshot’ task that is provided by liquibase plugin

This is generally not an easy situation. However, in your particular example, Liquibase makes this easy. You can add liquibaseTaskPrefix=lb (or whatever prefix you want) in your file and the Liquibase plugin will prefix all tasks it adds with that value. Therefore, with that configuration, you would now have snapshot from nebula.release and lbSnapshot from org.liquibase.gradle.


Thanks a lot! I didn’t know that liquibase plugin has such feature! You made my day!
But I would really appreciate it if you could share your knowledge to solve such problems in general.
Thank you again!

There isn’t really a good way to solve the problem of using multiple plugins contributing the exact same task name in the same project except on a case by case basis.

For Liquibase, the case is very easy with the task prefix setting. If the plugin puts the logic that creates the task name in an overridable method, that’s also fairly easy, but most of the time, the methods aren’t that granular. You’d end up having to duplicate most of the plugin logic just to change that task name.

Without something like the task prefix that Liquibase has, it’s probably easier to just split the concerns. Put the database concerns (or whatever else it is) in a different subproject of the build than the application bundling that would be released.