Hi! I’m writing a gradle plugin that adds a dependency to a project defined in the same repository, and I’m trying to figure out a way to share a constant between the dependency and the plugin code.
plugin/build.gradle:
class MyPlugin implements Plugin<Project> {
void apply(Project project) {
project.configurations.create("conf")
project.dependencies.add("conf", "org.my.project:dependency:XXX")
}
}
dependency/build.gradle:
apply plugin: 'maven-publish'
publishing {
publications {
maven(MavenPublication) {
version = 'XXX'
...
}
}
}
Is there a way I can define the version XXX
somewhere in a constant and refer to it in both MyPlugin.apply
and plugin/build.gradle
so that I don’t have to update both every time? I tried defining a system property in settings.gradle
but that is not visible in MyPlugin.apply
.