1

When running a test that has previously run successfully but now groovyc throws:

Information:Groovyc: While compiling tests of project.module.test:java.lang.NoClassDefFoundError: path.to.your.clas.User
    at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:46)
...
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    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:748)

I have tried invalidating cache and restart, re-loading the groovy-all dependency and others to no avail.

Nicholas Fitton
  • 573
  • 1
  • 4
  • 10

1 Answers1

1

I found a solution to this problem. find groovy imports of your class path.to.your.clas.User, delete the imports and run the test. This will obviously fail, then re-import your dependency and run the test again, the changes will be detected and the tests will compile again.

Nicholas Fitton
  • 573
  • 1
  • 4
  • 10
  • That sounds like a nightmare to work with and the real problem is more likely something else (e.g. you are triggering a recompile with the change that never get triggered). If this is intellij specific: don't use the intellij runner for tests, but use the runner of your build-tool. – cfrick Jul 06 '20 at 12:30