'Custom gradle plugin - buildscript dependencies
I am trying to write a custom gradle plugin (kotlin/kotlin dsl) that will allow me to set all sorts of things in the build scripts. I would like to add dependencies on build tooling, such as detekt, log4j2, ktlint, and even configure them. So for example, including the plugin will add detekt tasks to the build.
I have a basic binary plugin with a task, but I am having difficulty constructing a good web-search to find what I need. Can anyone please:
- provide some clues
- give me some search terms
- point me at an article
- or point me at a good example?
Thanks in advance.
Phill
Edit: this plugin class compiles, and seems acceptible to the receiving build script, but no detekT tasks appear in the receiving build.
class BuildCommonPlugin: Plugin<Project> {
override fun apply(project: Project) {
project.dependencies
.create("io.gitlab.arturbosch.detekt:1.19.0")
}
}
EDIT: At the comment I am using a 'buildSrc' type plugin. The irritating thing is that I need to duplicate this in each grade project, and when I find an improvement I need to update them all.
How easy is it to convert a 'buildSrc' into a publishable plugin?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
