grails / grails-core

The Grails Web Application Framework
http://grails.org
Apache License 2.0
2.78k stars 950 forks source link

Test doesn't work after upgrade to Grails 3.2.8 and Gorm 6.1.0.RC2 #10549

Closed antonevane closed 7 years ago

antonevane commented 7 years ago

I'm unable to run test after upgrade to the latest Grails and Gorm

Task List

Steps to Reproduce

  1. Run `gradlew test

Expected Behaviour

Tests should start

Actual Behaviour

./gradlew test
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:buildProperties UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:compileTestGroovystartup failed:
General error during canonicalization: java.lang.NoClassDefFoundError: Unable to load class grails.test.mixin.domain.DomainClassUnitTestMixin due to missing dependency org/grails/datastore/mapping/simple/SimpleMapDatastore

java.lang.RuntimeException: java.lang.NoClassDefFoundError: Unable to load class grails.test.mixin.domain.DomainClassUnitTestMixin due to missing dependency org/grails/datastore/mapping/simple/SimpleMapDatastore
        at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1101)
        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1079)
        at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:537)
        at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:174)
        at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:60)
        at org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonServer.execute(CompilerDaemonServer.java:31)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:87)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:377)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: Unable to load class grails.test.mixin.domain.DomainClassUnitTestMixin due to missing dependency org/grails/datastore/mapping/simple/SimpleMapDatastore
        at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:392)
        at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:275)
        at org.codehaus.groovy.ast.ClassNode.getInterfaces(ClassNode.java:370)
        at org.codehaus.groovy.ast.ClassNode.getAllInterfaces(ClassNode.java:433)
        at org.codehaus.groovy.ast.ClassNode.getAllInterfaces(ClassNode.java:425)
        at org.grails.compiler.injection.GrailsASTUtils.findInterface(GrailsASTUtils.java:1113)
        at org.grails.compiler.injection.test.TestMixinTransformation.weaveMixinIntoClass(TestMixinTransformation.java:218)
        at org.grails.compiler.injection.test.TestMixinTransformation.weaveMixinsIntoClass(TestMixinTransformation.java:199)
        at org.grails.compiler.injection.test.TestMixinTransformation.weaveMixinsIntoClass(TestMixinTransformation.java:184)
        at org.grails.compiler.injection.test.TestForTransformation.weaveMixinClass(TestForTransformation.java:404)
        at org.grails.compiler.injection.test.TestForTransformation.weaveMock(TestForTransformation.java:250)
        at org.grails.compiler.injection.test.TestForTransformation.testFor(TestForTransformation.java:233)
        at org.grails.compiler.injection.test.TestForTransformation.handleTestForAnnotation(TestForTransformation.java:131)
        at org.grails.compiler.injection.test.TestForTransformation.visit(TestForTransformation.java:123)
        at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134)
        at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178)
        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
        ... 24 more

General error during canonicalization: java.lang.NoClassDefFoundError: Unable to load class grails.test.mixin.domain.DomainClassUnitTestMixin due to missing dependency org/grails/datastore/mapping/simple/SimpleMapDatastore

java.lang.RuntimeException: java.lang.NoClassDefFoundError: Unable to load class grails.test.mixin.domain.DomainClassUnitTestMixin due to missing dependency org/grails/datastore/mapping/simple/SimpleMapDatastore
        at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1101)
        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1079)
        at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:537)
        at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:174)
        at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:60)
        at org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonServer.execute(CompilerDaemonServer.java:31)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:87)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:377)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: Unable to load class grails.test.mixin.domain.DomainClassUnitTestMixin due to missing dependency org/grails/datastore/mapping/simple/SimpleMapDatastore

Environment Information

graemerocher commented 7 years ago

Can you please confirm you have the following dependency in build.gradle?

testCompile "org.grails:grails-datastore-gorm-test:$gormVersion"
antonevane commented 7 years ago

@graemerocher I didn't have it. Grails 3.2.7 and Grom 6.0.9 combination didn't give the issue. Is it the related to Gorm 6.1.0?

Adding the following dependency fixed the issue. testCompile "org.grails:grails-datastore-gorm-test:$gormVersion"

graemerocher commented 7 years ago

Some classes that were used only for testing were moved to the grails-datastore-gorm-test project for consistency in GORM 6.1 yes.