I am encountering this exception.
Exception :java.lang.NoSuchMethodError: org.codehaus.groovy.ast.ModuleNode.getStarImports()Ljava/util/List;
I have tried various version of groovy jars like groovy 1.8.4, groovy 1.8.6 etc. But I am not able to get rid of this error.
This happened to me when I had 2 different versions of Groovy in the classpath at the same time. Check your classpath especially if using something that obfuscates it such as Eclipse or Maven.
In my specific case, I was trying to use Groovy 1.8.6 but a Maven dependency was dragging in 1.6.5 causing errors. It worked fine running unit tests on the command line, but not from within Eclipse.
To compile with Groovy 2.x, try adding this to the gmaven plugin element:
<configuration>
<providerSelection>2.0</providerSelection>
<source>2.0</source>
</configuration>
For example:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<providerSelection>2.0</providerSelection>
<source>2.0</source>
</configuration>
</plugin>
</plugins>
</build>
with
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.1.9</version>
</dependency>
</dependencies>
seems to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With