I understand the risk of mixed classpaths, but at least there could be a kind of flag “inherit project’s dependencies” true/false for the plugin settings. I guess there will be no problem with inheriting dependencies by the plugin in the most cases.
Speaking about the codenarc I’m not sure. The plugin itself doesn’t seem to have any option of passing classpath settings, unless there is general way for gradle plugins. I tried Peter’s suggestion as follows:
with no success. There is an error:
$ gradle clean check
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':codenarcMain'.
> java.lang.ClassNotFoundException: org.codenarc.ant.CodeNarcTask
When static analysis with codenarc is run as unit test then the same classpath is available for it as for the unit test itself. When run from command line, just regular classpath switch is passed:
@java -classpath %GROOVY_JAR%;lib/CodeNarc-0.5.jar;lib/log4j-1.2.14.jar;lib org.codenarc.CodeNarc %*
I don’t how it relates to gradle/maven plugins though.