I created the gradle-jenkins-jobdsl plugin. But currently it’s hardcoded to use the dependency ‘org.jenkins-ci.plugins:job-dsl-core:1.23’. I would like to implement the toolVersion principle as used by the Gradle code quality plugins, so it can be used flexibly with other versions of this dependency.
I’ve looked through the code of the Gradle code quality plugins, and noticed two different ways:
- CheckStyle, CodeNarc, JDepend and PMD
Which use an AntBuilder to execute a AntTask to do the work.
Using methods I don’t understand…
@Inject
Instantiator getInstantiator() {
throw new UnsupportedOperationException();
}
@Inject
IsolatedAntBuilder getAntBuilder() {
throw new UnsupportedOperationException();
}
How can these methods be used… I see them used as:
CodeNarc() {
reports = instantiator.newInstance(CodeNarcReportsImpl, this)
}
antBuilder.withClasspath(getCodenarcClasspath()).execute {
...
}
- FindBugs
Which seems to use a separate Gradle worker process
Which of these two ways is the way to go? Or are there other (better?) ways to do this? Is there documentation somewhere on how to do this? How this all works? (I haven’t found any yet…)
Hope someone give some pointers, examples, etc.