Composite build: get parent plugin version

25 Views Asked by At

I have primary project A and included project B.
Both projects apply the same plugin P.
And I need in project B apply plugin P of the same version, as project A.
In A settings.gradle.kts:

pluginManagement {
  plugins {
    id("P") version "1" apply false
  }
}

includeBuild("B")

In B settings.gradle.kts:

pluginManagement {
  plugins {
    val ver = "Need as in A, i.e. 1"
    id("P") version ver apply false
  }
}

I tried to use gradle.parent.pluginManager.findPlugin("P") in B settings.gradle.kts, but it returns null (suppose because it has not been applyed yet).
May be I need wait until A will finish configuration, but action in gradle.parent.settingsEvaluated never called in B.

Is it possible access parent's plugins at all?

0

There are 0 best solutions below