mvn multimodule project: "ignoring" modules classpath issue

I've a multimodule project with a parent pom and
children modules like:

parent :
  child2 depends on child1

... many more modules

When I was using eclipse, I tend to install child1 to .m2 and then close child1 to avoid slow compilation times. Eclipse can then load the .m2/../child1.jar file straight away and sucesfully compile child2.

I am trying to do the same with IDEA but can't make it work. When I go to "Maven Projects" and do "Ignore Project" for child1, then child2 has compilation errors as neither child1 nor .m2/repository/.../child1.jar is used.

Can I make this work? Compilation times are really high if I have all modules open (java+scala modules, many times it takes 4 minutes to compile)

Comment actions Permalink

The maven way to do something like this is to use the profile feature and create a profile for the expensive module(s) to build and only activate it when you want to build it. It's easy to activate a Maven profile from the IDE. Something like the following in your POM file:


Then remove the child1 module from the default module list that is built and activate, when desired, the expensive-modules-to-build profile with the -P switch from command line or use the Maven tool window in the IDE and add a checkmark on the profile(s) you want enabled.

Comment actions Permalink

sorry, edited this msg as I posted in the wrong thread.

Profiles might work but it would quite complicate the maven pom and working with it. There are around 30 modules and from time to time I work on one or the other.

What also works in mvn is if

cd child1
mvn install

cd ../child2
mvn compile

I might have some luck if I import the modules as standalone instead of children of a parent pom


Please sign in to leave a comment.