Cannot add task ':check' as a task with that name already exists

I use the Gradle plugin ‘Grails’ and ‘codenarc’, but there seems to be an issue with a task name. How can I use both plugins? Is there a way to override one of the tasks?

It isn’t possible to make one plugin override another plugin’s tasks from the outside. The ‘check’ task is added by the ‘java’/‘groovy’ plugin. The third-party ‘grails’ plugin is very special in that it dynamically creates tasks that delegate to Grails’ build system. I don’t know if it is compatible with other plugins (make sure to try with the latest version).

Hi Peter, thanks for replying. I am sorry, but I just noticed that I did not formulate my question very clearly.

I try to use the’grails’plugin, the ‘groovy’ plugin and the ‘codenarc’ plugin.

As it seems the groovy plugin and grails are defining a task called ‘check’ so when I run gradle I get the following message:

Cannot add task ‘:check’ as a task with that name already exists.

I cannot get them to work together. But what I want to achieve is to use the codenarc plugin. And without ‘groovy’ plugin this one seems to not add any tasks.

Just doing apply plugin:‘codenarc’ does not add the task codenarcMain for example.

Sorry, I am trying to figure out my way around this.

That’s what I understood, and I’m not sure if you can do much about it, except trying with the latest version of the ‘grails’ plugin. Perhaps that plugin isn’t meant to be used together with other plugins. (As I said it’s very special in that it dynamically creates tasks that delegate to Grails’ build system, but I don’t know how exactly that is implemented.)

okay thanks. I will see what I find :slight_smile: Thanks for your help