How Can I define core gradle plugin without a version in version-catalog plugin

Hello Folks,

Currently, we’re working on migration from maven to gradle.
I have to say that gradle is more developer friendly and flexible. I like it.
Nowadays, I’m working on version-catalog on gradle to reuse common components.
In order to prevent plugin duplication, i want define plugin like this:

            plugin('plugin.codeCoverage', 'jacoco').version('')

if i don’t pass version, build is failed. If i pass the empty version again build is failed.

Is there any way to properly define core gradle plugin in the version-catalog?

Many thanks in advance,
With My best regards,
Onur.

Hello @MuhendisBey

not sure if that what you want or not but

you can define the plugin with version in the root project and only declare the plugin in the sub project so all sub project would use the same version from the root

check this one

https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl

or you could use the pluginManagement
check this example

https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_version_management

hope that help and have a nice day :slight_smile:

No, that is not at all what he described. :wink:

You cannot have built-in plugins in a version catalog, as plugins as of now must always have a version in the version catalog. If you really want it bad, you could write a convention plugin that applies the built-in plugin and then add that convention plugin to the version catalog.