On 20/09/2010, at 2:55 AM, Maciej Kapusta wrote: > Hi, > > I am poring my application from Maven to Gradle. It uses Hibernate and needs > to perform class instrumentation of certain classes. All works well except > that it seems that Gradle is pushing it's own asm (asm-3.2) version totally > disregarding the one that Hibernate depends upon (asm-1.5.3). It looks as if > the separation of classloaders for the ant tasks in Gradle does not work > well.
The problem is that the ClassLoader which loads the Ant classes also contains a bunch of other classes (such as asm, for example). There's a jira issue to fix this: http://jira.codehaus.org/browse/GRADLE-1104 A potential workaround is to set reverseLoader to true when you call taskdef. For example: ant.taskdef(classname: 'someclass', classpath: somePath, reversLoader: true) > > Output from gradle instrument command. > * What went wrong: > Execution failed for task ':instrument'. > Cause: java.lang.NoSuchMethodError: > org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVis > itor;Z)V > > Can anybody point me to some workaround? I really like Gradle, and would not > want to go back to Maven. > > Interesting lines from my build.gradle: > > dependencies { > hibInstrument "org.hibernate:hibernate:3.2.6.ga" > > ...... > } > task instrument(dependsOn: compileJava) << { > ant.taskdef(name: 'hibInstrument', > classname: 'org.hibernate.tool.instrument.cglib.InstrumentTask', > classpath: configurations.hibInstrument.asPath) > ant.hibInstrument(verbose: 'true'){ > fileset(dir:"$buildDir/classes/main/com/seriouscorp/fcc/domain"){ > include(name: "TestCaseResult.class") > } > } > } > > > -- Adam Murdoch Gradle Developer http://www.gradle.org CTO, Gradle Inc. - Gradle Training, Support, Consulting http://www.gradle.biz
