gmazzo/gradle-buildconfig-plugin

How to include as a dependency into buildSrc?

ArturSechko opened this issue · 1 comments

I'm trying to migrate my custom BuildConfig fields which are described in a plugin stored in buildSrc. That plugin is applied to gradle modules where needed. In order to use your plugin I need to include it as a gradle dependency in buildSrc. The problem is I'm missing dependency group and name to do so.

Sadly, the Gradle team has not been adding a method on DependencyHandler to support this (I even summited a PR but didn't go through).

All Gradle plugins follow a convention Maven coordinates you can use to <pluginId>:<pluginId>.gradle.plugin:<version> to include any plugin as a dependency of your buildSrc project.

So, if you have:

plugins {
  id("com.github.gmazzo.buildconfig") version "4.1.1"
}

It can be translated to:

dependencies {
    implementation("com.github.gmazzo.buildconfig:com.github.gmazzo.buildconfig.gradle.plugin:4.1.1")
}

Also, you can always inspect the legacy setup in the plugin entry at Gradle Plugins Portal and replace classpath with implementation:
image