0

I am working on multi-module Java EE web application project(maven project) which have 23 modules. It have main 4 modules which can be used separately and other modules are supported back end module for those 4 modules.

When the project is built, it takes 4-15 minutes to finish the build process because all the modules are built along with the build process.

  • When rebuilding, I want to avoid compiling and packaging sources/modules that are not changed, with the use of IDE itself. (Additionally I require selective cleaning of those modules that changed as well)
  • I want to build the project with selected modules which I require without using command line argument (with the use of IDE itself).

I am aware of maven up to some level also. Please someone help me to overcome these problems.

goldbows
  • 3
  • 4

1 Answers1

0

You can use and select those projects you would like to build via '--projects' like the following. Just let us imaging you have three modules like this:

 root (pom.xml)
   +--- m1 (pom.xml)
   +--- m2 (pom.xml)
   +--- m3 (pom.xml)

furthermore m3 depends on m2 and m1. So if you like to build only m3 if no other module has changed you can use:

mvn -pl m3 

(Please call from root location). with that maven build m3 module and will get the other dependencies from the local repository if not found there from your remote repository (repository manager). If wan't to be sure to work just with your current state you have to do a mvn install once before and afterwards you can reuses the other modules from the local repository.

There are other options available like the following:

 -am,--also-make                        If project list is specified, also
                                        build projects required by the
                                        list
 -amd,--also-make-dependents            If project list is specified, also
                                        build projects that depend on
                                        projects on the list

which can be given as supplemental arguments to build those modules.

I have my doubts that in IntelliJ there are just buttons/keystrokes which are configured in the way to use that from within IntelliJ directly. But you can configure the calls of Maven from within IntelliJ...

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • 1
    Sounds good. But doing this developer have to change the command line of maven configuration of IntelliJ once he or she adds some changes. Instead of that is there no way to conditional select modules? I meant is there a way to recognize which module has a change and rebuild that module only...? – goldbows Feb 13 '15 at 04:20