I have a Java/Gradle project within IntelliJ, it contains multiple modules, one of the modules common is nested within its super module.

PRODUCTMODULE
    src
    --com.org.bar
      -ClassImplemetation.java //(extends ClassToExtend from common module)
    build
     --com/org/bar
      -ClassImplementation.class

   COMMON-LIB---- (inner module)
   src
   --com.org.foo
     -ClassToExtend.java
   build
   --com/org/foo
     -ClassToExtend.class

In the PRODUCTMODULEs build.gradle i have added:

  implementation project(':PRODUCTMODULE:COMMON-LIB')

So that i can specify that common lib sub module's classes should be added to the 'PROJECTMODULE' classpath. Now, the project builds fine, but when i run it i get a NoClassDefFoundError targeting to the ClassToExtend class.
How could i make sure that that class is actually included in the build path?
My assumption is that it is correctly in the class path otherwise it would not copmpile.

0 Answers