I’m aware of toolVersion
property, I use it and even mentioned in the first post. Confusion came from your previous post as you mentioned switching back with CodeNarc version while the versions you used are Gradle versions. CodeNarc versions under debate are 0.21 and 0.23. Never mind though and thanks for clarification.
We’ll get here a bit out of scope of my former question, I hope that’s OK.
Compilation - maybe that’s only confusing message from CodeNarc but there you go:
:my-project:codenarcMain
Compilation failed for [SourceFile[C:\path\to\my-project\src\main\groovy\com\domain\something\SomeClass.groovy]].
I altered paths and names in the above but Compilation failed for is original and comes from CodeNarc (doesn’t fail a build, the source file is skipped from being analysed).
I’m not certain about that but I think some CodeNarc rules require compilation and it’s being done within codenarcMain/codenarcTest task. Could you clarify that, please?
Maybe it’s worth of adding that the above message still appears with CodeNarc version 0.22, but on the same codebase and CodeNarc 0.23 it’s all right. There is quite a big difference in Groovy versions used between those two CodeNarc versions though (mentioned below).
Speaking about classpath, yup it’s certainly done in isolation or at least it has been. I wonder which groovy version is used now though. The one on which CodeNarc depends or the one specified in compile configuration for use of the groovy plugin itself.
I was assuming the first is true, especially I can see the older version of groovy is (or was) being downloaded (the one CodeNarc depends on) and because of that I though it fails to compile some source files as the sources being analysed are written with newer groovy version than CodeNarc uses. However this made me confused again:
Command issued: gradle dependencies --configuration=codenarc
With CodeNarc version 0.22 it gives:
codenarc - The CodeNarc libraries to be used for this project.
\--- org.codenarc:CodeNarc:0.22
+--- org.gmetrics:GMetrics:0.5
| \--- org.codehaus.groovy:groovy-all:1.7.5
+--- org.codehaus.groovy:groovy-all:1.7.5
While with CodeNarc version 0.23:
codenarc - The CodeNarc libraries to be used for this project.
\--- org.codenarc:CodeNarc:0.23
+--- org.codehaus.groovy:groovy:2.1.8 -> 2.4.3
+--- org.codehaus.groovy:groovy-xml:2.1.8 -> 2.4.3
| \--- org.codehaus.groovy:groovy:2.4.3
+--- org.codehaus.groovy:groovy-ant:2.1.8 -> 2.4.3
| +--- org.codehaus.groovy:groovy-groovydoc:2.4.3
| | +--- org.codehaus.groovy:groovy-templates:2.4.3
| | | +--- org.codehaus.groovy:groovy-xml:2.4.3 (*)
| | | \--- org.codehaus.groovy:groovy:2.4.3
| | \--- org.codehaus.groovy:groovy:2.4.3
| +--- org.codehaus.groovy:groovy:2.4.3
| +--- org.apache.ant:ant-antlr:1.9.4
| \--- org.apache.ant:ant-junit:1.9.4
+--- org.gmetrics:GMetrics:0.7
| +--- org.codehaus.groovy:groovy:[2.1.0,) -> 2.4.3
| +--- org.codehaus.groovy:groovy-xml:[2.1.0,) -> 2.4.3 (*)
| \--- org.codehaus.groovy:groovy-ant:[2.1.0,) -> 2.4.3 (*)
\--- junit:junit:4.8.1
Both above outputs are done with the same Gradle version. Despite that in the first example CodeNarc’s (really) old version of Groovy is listed and not evicted. In the second example they upgraded to 2.1.8 which is nice but seems it doesn’t matter actually as it’s evicted anyway and the version declared as compile dependency is used, compile 'org.codehaus.groovy:groovy-all:2.4.3'
. So it’s not so isolated anymore, is it?
Sorry for the long post but I would really like to understand what’s going on here.