Pass thru arguments to plugins

plugins

(Dell Green) #1

Hi there,

Apologies if this is a stupid question. If I apply a plugin in my gradle script, lets say PMD , and this supports more options than are exposed via the gradle interface, for example PMD has “threads” argument to utilize mutli-threads scanning to speed up the process. Is there a way to pass these arguments through to the underlying library/cli?

Or should I not use the gradle plugin and write my own task they calls the PMD library/cli directly?


(Mark Vieira) #2

Under the hood the plugin is actually calling the PMD Ant task. It looks like configuring threads is specific to the command line interface and not available via the Ant task.


(Dell Green) #3

OK, many thanks. I’ll look into that.:grinning:


(Dell Green) #4

Just had a quick look at latest source code for ant PMDTask and it looks like is has public methods now for setting the number threads :grinning: v5.5.0, v5.4.1, v5.3.6 (havent checked any earlier)

Apologies not sure how the ant xml gets mapped into the java classes, but does this mean if they are available in t the PMDTask.class as public setters that they can be used int he ant xml task and mapping is automatically handled? UPDATE: just read writing ant tasks and appears it uses reflection.

With this in mind, does this make it fairly simple then for the gradle plugin to expose it?


(Mark Vieira) #5

I would say so. Would you consider contributing a pull request for this?


(Dell Green) #6

Sure, I’ll try and set some time aside for this.