Philip W
04/22/2025, 8:01 PMlifecycle.afterProject
. But the project does not find the plugin this way, but it finds the plugin if I apply it directly in my build.gradle.kts script.Philip W
04/22/2025, 8:01 PM// init.gradle.kts
settingsEvaluated {
pluginManagement {
repositories {
maven(url = "<https://maven.pkg.github.com/hfhbd/extract-publications>") {
name = "GitHubPackages"
credentials(PasswordCredentials::class)
}
gradlePluginPortal()
}
plugins {
id("io.github.hfhbd.extract-publications") version "0.0.3"
id("io.github.hfhbd.extract-publications.root") version "0.0.3"
}
}
}
lifecycle.afterProject {
if (isolated.buildTreePath == ":") {
if (this == rootProject) {
pluginManager.apply("io.github.hfhbd.extract-publications.root")
}
pluginManager.withPlugin("maven-publish") {
pluginManager.apply("io.github.hfhbd.extract-publications")
}
}
}
Philip W
04/22/2025, 8:02 PMPlugin with id 'io.github.hfhbd.extract-publications.root' not found.
Philip W
04/22/2025, 8:03 PM// build.gradle.kts
plugins {
id("io.github.hfhbd.extract-publications.root")
}
Vampire
04/22/2025, 8:42 PMplugins { ... }
block does add it to the classpath and if not using apply false
applies it.Philip W
04/22/2025, 9:39 PMVampire
04/23/2025, 6:56 AMpluginManagement { plugins { ... } }
block only defines default versions if the plugin is used in a plugins { ... }
block later on without a version, but it does not add anything anywhere.Philip W
04/23/2025, 12:54 PMVampire
04/23/2025, 2:03 PMplugins
blocks like that.
plugins
blocks are extracted before the script in question is compiled.
This is then used to get these plugins for compiling the build script.
Additionally the extracted block is applied to a dummy project to find out which type-safe accessors to generate and also add those to the compile classpath for the script.