The new @Builder annotation in Groovy 2.3.0 will occur compilation error if build with Gradle(both 1.11 and 1.12)

However, I can generate the .class file with groovyc in Groovy 2.3.0, this below is the error log:

E:\dev\content\test-ws\ii-13-groovy230-test\hello-groovy230-gradle\src\main\groovy\ClassA.groovy: 8: Can’t load builderStrategy ‘groovy.transform.builder.DefaultStrategy’ java.lang.ClassCastException: groovy.transform.builder.DefaultStrategy cannot be cast to org.codehaus.groovy.transform.BuilderASTTransformation$BuilderStrategy

@ line 8, column 1.

@Builder

^

And this is my build.gradle as below: apply plugin: ‘groovy’

repositories {

mavenLocal()

mavenCentral() }

dependencies {

compile

‘org.codehaus.groovy:groovy-all:2.3.0’ }

Thanks

It’s a bug in the ‘@Builder’ implementation (‘org.codehaus.groovy.transform.BuilderASTTransformation’). It needs to load the strategy classes from the transform loader, like for example ‘org.codehaus.groovy.transform.trait.TraitASTTransformation’ does. Can you raise an issue at http://jira.codehaus.org/browse/GROOVY?

I’ve filed http://jira.codehaus.org/browse/GROOVY-6774 for this. Thanks for the report.

Thanks a lot.