I am writing my own plugins to extend gradle, those plugins are separated in different jars. In order for user to use my plugins, they need to adding following to their build.gradle file:
buildscript {
repositories {
ivy {
ivyPattern '...'
artifactsPattern '...'
}
}
dependencies {
compile group:'myorg', name: 'mymodule', version: '1.0'
compile group:'myorg', name: 'mymodule2', version: '1.0'
}
}
apply plugin: 'myplugin1'
Which is quite tedious, I want to put this buildscript section in a common gradle file, and my user only need to apply from: common.gradle to have it set up.
But seems a buildscript section in a common.gradle doesn’t apply to the target build.gradle file, the closest I can get is:
buildscript {
apply from: common.gradle, to: buildscript
}
But what I want in this common.gradle file is not only setup buildscript, but also some other common settings, so the ideal is:
apply from: common.gradle
Which applies both the buildscript setup and some other common settings to the project. Is there a way to achieve so?