1

My groovy file contains:

@Grapes([

    @Grab('org.codehaus.groovy.modules.http-builder:http-builder:0.7'),
    @Grab('org.apache.httpcomponents:httpmime:4.5.1')

])

.......code

I am trying to compile groovy and java code. But I am getting below error:

java.lang.RuntimeException: Transform groovy.grape.GrabAnnotationTransformation@69bda33a cannot be run
billjamesdev
  • 14,554
  • 6
  • 53
  • 76
LifeIsButifool
  • 129
  • 2
  • 12

2 Answers2

0

This works for me, note that I did change HttpBuilder to v.0.7.1:

@Grapes([
    @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1'),
    @Grab(group='org.apache.httpcomponents', module='httpmime', version='4.5.1')
])
pczeus
  • 7,709
  • 4
  • 36
  • 51
0

Likely way too late for you to care, but I saw the same error just now.

I suspect the problem is that the @Grab annotation can't take effect because Maven is controlling the dependencies, or perhaps because Maven is trying to compile both Groovy and Java code, and the class loader created by the @Grab annotation can't influence the Java code.

Upshot is, I suspect you (and I) need to move the dependency out of the Groovy class in question, and put it into the pom.xml file Maven is using.

Matt Sheppard
  • 116,545
  • 46
  • 111
  • 131