javamavennetbeansnetbeans-platform

Building parent project always recompiles all modules


I have a parent project with many child modules (it's a Netbeans platform application). The app builds and runs OK.

If I run mvn compile on the parent project twice, the 2nd time it's fast because Maven says "Nothing to compile - all classes are up to date" for all the modules. Good.

If I run mvn install on the parent project twice, the 2nd time is as long as the 1st one because only the first module is seen as "up to date". Maven detects changes for all the other modules and recompiles the source code.

I used mvn -X to try to understand what happens. For the 2nd module org-jjazz-upgrade I get this:

[DEBUG] New dependency detected: D:\JeromeDocs\NetBeansProjects\JJazzLab\modules\Utilities\target\org-jjazz-utilities-1.0-SNAPSHOT.jar
[INFO] Changes detected - recompiling the module!

org-jjazz-utilities is the first module which was up to date...

Is there a way to avoid this global recompilation with the install goal ?

Project source code with mvn -X install log (see install.txt) is available here.


Solution

  • Well, it's due to a maven-compiler-plugin bug documented here, and has been unsolved for almost 10 years, despite many votes...

    I just had to set useIncrementalCompilation to false in the plugin configuration (I use 3.10.0) and then it worked "normally". Quite counter-intuitive...