Check your module classpath for missing or conflicting dependencies [closed]

If your project is set with a JDK, then probably IDE (Intellij) does not have JDK set but your built application could run just fine with the required JVM.


In our project we encountered this because we added the same directory to both production and the test sources.

sourceSets {
  main.java.srcDirs += 'src/main/kotlin/'
  main.java.srcDirs += 'build/generated/source/protos/main/java'
  test.java.srcDirs += 'src/test/kotlin/'
  test.java.srcDirs += 'build/generated/source/protos/main/java'
}

Removing the duplicate from the test sources fixed the problem.

sourceSets {
  main.java.srcDirs += 'src/main/kotlin/'
  main.java.srcDirs += 'build/generated/source/protos/main/java'
  test.java.srcDirs += 'src/test/kotlin/'
}