Reputation: 853
I have developed an internal plugin. The plugin has its own version. I then use that plugin for a build process in a repository. If I change the version of the plugin, I have to update the build.gradle to spell our the new version. I have about 100 of these repositories. Is there a way to specify in my build.gradle to use the latest version of the plugin that can be found in that location? I could ran a batch file before gradle that find the latest, updates build.gradle with that number and then runs the build process but this is a big work around to a functionality that should be available. See code below where I call the plugin that I change quite often:
buildscript {
repositories {
maven {
url "c:/git/_TEST/plug-in"
}
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath group: 'com.myplugin.gradle', name: 'com.myplugin.mypluginbuild', version: '1.0'
}
apply plugin: 'com.myplugin.mypluginbuild'
}
if I don't specify the version, it returns an error. Any suggestions?
Upvotes: 6
Views: 5759
Reputation: 3332
For those who use plugins{} block, gradle7+ supports dynamic version, which includes + and latest.release.
plugins {
id "your-plugin-id" version "1.0.+"
}
Upvotes: 5
Reputation: 853
I have a solution to this question. The + specified in the version field will do the trick. It will enable gradle to use the latest plug-in automatically. I.e:
dependencies {
classpath group: 'com.myplugin.gradle', name: 'com.myplugin.mypluginbuild', version: '1.+'
}
Upvotes: 0
Reputation: 2080
It's not possible this way. See the plugins {} block and plugins documentation.
Maybe script plugins are way to go:
apply from: 'my_script_plugin.gradle'
Upvotes: 2