2
  1. I wrote some groovy code, compiled using compile localGroovy() and published the jar to artifactory.
  2. Now I wrote a gradle plugin, where I have compile localGroovy() and compile "gav of jar above"
  3. I build my plugin and publish to same artifactory.

Now, To use the above custom plugin, I am having

buildscript {
    dependencies {
        classpath localGroovy()
        classpath "gav of plugin", transitive: true
    }
}

As you see, I'm using same localGroovy() everywhere. My gradle version is also same. Now with above, I get the below error:

Caused by: java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
    at com.oracle.emdi.tools.lrgmanager.LrgManager.<clinit>(LrgManager.groovy:44)
    at com.oracle.emdi.gradle.testinfra.tasks.PrintLrg.class$(PrintLrg.groovy)
    at com.oracle.emdi.gradle.testinfra.tasks.PrintLrg.$get$$class$com$oracle$emdi$tools$lrgmanager$LrgManager(PrintLrg.groovy)
    at com.oracle.emdi.gradle.testinfra.tasks.PrintLrg.print(PrintLrg.groovy:38)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)

As I read in this page and here the issue is related to groovy / gradle version mismatch. But this is not the case here

Community
  • 1
  • 1
Sundeep Gupta
  • 1,887
  • 3
  • 24
  • 35
  • 1
    Groovy version mismatch is the only good explanation. `LrgManager` was very likely compiled with a different major Groovy version than what's used by the Gradle build. Looks like the consuming Gradle build uses Gradle 1.x. No need for `classpath localGroovy()` in the build that consumes the plugin (maybe that's even causing the problem). – Peter Niederwieser Jul 15 '14 at 11:41
  • You are right. I was using older gav (where I was compiling using groovy 2.x). Fixed that and it works. Thanks @PeterNiederwieser – Sundeep Gupta Jul 15 '14 at 13:13

0 Answers0