Reputation: 9816
This is very puzzling. I have a multi module polyglot JVM project built using Gradle. I have a few java modules and a couple scala modules. The scala module uses ScalaTest as the test framework. I set up the Gradle to use the scalatest plugin to run tests. I had the whole thing running like a charm in IntelliJ for about a month (using the Gradle idea plugin). Now all of a sudden the ScalaTest specs won't run from the IDE anymore with the following error:
Unable to load a Suite class. This could be due to an error in your runpath. Missing class: com.mypackage.MySpec
Does anybody know what's going on? I am not sure what has changed since the first time I set up my build file that might have messed this up. This is really frustrating. Ideas?
EDIT: Apparently my junit tests won't run either. Looks like the compiled classes aren't on the classpath used by Intellij. This is what I get if I try to run a JUnit test case:
Class not found: "com.mypackage.MyUnitTests"
Upvotes: 7
Views: 6233
Reputation: 9816
Figured it out. I was messing with my IntelliJ configuration files after this blog post and I accidentally messed up my project output folder (in the updateBuildOutputFolderForGradle
function) so that IntelliJ wasn't able to find the classes at runtime.
Upvotes: 1
Reputation: 21381
Chances are that since this is a multi-language project IntelliJ can't tell which are the source folders. Check under Project Structure
> Modules
(each of your module) and ensure Sources
and Tests
dirs are correctly marked.
Upvotes: 2