openrewrite / rewrite-gradle-plugin

OpenRewrite's Gradle plugin.
Apache License 2.0
64 stars 40 forks source link

`org.openrewrite.rewrite` plugin conflicts with `io.moderne.rewrite` #137

Closed jkschneider closed 1 year ago

jkschneider commented 1 year ago

Both try to configure an extension named rewrite.

shanman190 commented 1 year ago

Just FYI, order matters here:

Success:

plugins {
    id "org.openrewrite.rewrite" version "latest.release"
    id "io.moderne.rewrite" version "latest release"
}

Failure:

plugins {
    id "io.moderne.rewrite" version "latest release"
    id "org.openrewrite.rewrite" version "latest.release"
}
jkschneider commented 1 year ago

Thanks @shanman190. Noticed this. Trying to find a way to either remove the existing extension/tasks from moderne plugin when OSS plugin already applied or determine that the rewrite plugin will be later applied.

shanman190 commented 1 year ago

So the easiest way at the moment would be to just swap the OSS plugin to TaskContainer#maybeCreate(..). That would resolve the issue so that order no longer mattered.

If we were talking about this more longer term, you'd probably have to ask the TaskContainer if it knew about an extension named rewrite, if none existed register one. If one exists, then apply any configurations.

EDIT: just a note that this second mechanism would require moving the base Gradle version from 4.0 which isn't desired at this time.

sambsnyd commented 1 year ago

This has been fixed as of 5.34.0