refactoring project into modules: module dependencies are not sufficiently track and constantly lost when rebuilding project.


I had spent some time factoring a project's java packages into modules. The problem is intellij does not reliably propagate a module's gradle (maven) dependencies to any _referring_ module.

In other words:


   core-module (gradle with maven deps A, B, C)

   module1 (depends on core-module) <-- build fails because dep A is not included in class path. if I add class path but then rebuild, intellij forgets class path, or forgets dep on core-module.


Seriously, I will bail back to eclipse if this is a bug.



Comment actions Permalink

Having found the module dependency panel (docs say use project panel (clover-leaf ,) but it's under F4) I added dependencies. OK better. 


However the project level classes now fail compilation, but the editor knows where the code is. Basically the compiler doesn't know about the modules, even if I add them as explicit dependencies. I cannot "add" the classes in question and cannot test because of the compilation problems, which the IDE doesn't allow me to fix apparently.

Comment actions Permalink

If your project is Gradle or Maven based, you should manage dependencies via pom.xml or build.gradle files instead of using IDEA Module Dependencies configuration. IDE will import the dependencies automatically and the project will work in the same way as it works from the command line build.

Comment actions Permalink

I guess that's the lesson learned. I reverted to gradle configuration, although I had wished to glide over grubby details. 

It'd be nice if the IDE 'just did the right thing' with a configured build system. Should be easy, right? ;)

thanks for the reply.


Please sign in to leave a comment.