Maven Compiler Plugin
  1. Maven Compiler Plugin
  2. MCOMPILER-209

Incremental compilation doesn't work unless useIncrementalCompilation is set to 'false'

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1
    • Fix Version/s: None
    • Labels:
      None

      Description

      The compiler plugin has the useIncrementalCompilation flag. However, when this flag is set to true and using the javac compiler, the compilation is not very incremental; the compiler always at least claims it is rebuilding all source files (and compile times are consistent with this being what it is actually doing, though it is hard to tell). If I set useIncrementalCompilation to false, then it actually does report that some modules are up-to-date, and some only need a subset of their files compiled.

      It seems that one or more of the following is happening:

      • useIncrementalCompilation has some meaning that is very different from what a user would expect, actually controlling whether the compiler plugin uses some internal incremental compilation mechanism vs. incremental compilation support built-in to the particular compiler backend. One would expect this flag to turn on incremental compilation vs. build-everything.
      • The log messages do not reflect what it is actually doing; that is, it seems possible that it's saying "Compiling 164 source files" when it's really handing 164 source files off to the compiler for potential compilation. If this is the case, it is very confusing and misleading.
      • The logic of useIncrementalCompilation is just inverted. Looking at the source code for the abstract compiler MOJO, it doesn't look like it's quite this simple, but I also don't know what all the various components at work are doing.
      • There is a bug in the implementation of useIncrementalCompilation.

      The result of all this is incremental compilation with Maven is very confusing and difficult to understand.

        Activity

        Hide
        Rade Martinović added a comment -

        This is quite unpleasant bug for me, it increases the overall time of compilation since I am forced to do clean compile each time I do the project build.

        The workaround of setting useIncrementalCompilation to false seems to help.

        Show
        Rade Martinović added a comment - This is quite unpleasant bug for me, it increases the overall time of compilation since I am forced to do clean compile each time I do the project build. The workaround of setting useIncrementalCompilation to false seems to help.
        Hide
        Alexander Kriegisch added a comment - - edited

        Sample AspectJ + Maven project showing what needs to be done in order to make compilation work. Please note that I have to set 'useIncrementalCompilation' to 'false' in order to make incremental compilation work (reverse logic, needs to be fixed).

        I would like to see this issue resolved, I think it should be easy to fix and is not just a minor thing.

        Show
        Alexander Kriegisch added a comment - - edited Sample AspectJ + Maven project showing what needs to be done in order to make compilation work. Please note that I have to set 'useIncrementalCompilation' to 'false' in order to make incremental compilation work (reverse logic, needs to be fixed). I would like to see this issue resolved, I think it should be easy to fix and is not just a minor thing.
        Hide
        Aditya Kishore added a comment -

        As someone who ran into different facet of this issue with different projects, I have documented my findings here:
        http://bcn.adityakishore.com/2014/11/broken-incremental-compilation-with.html

        With current assumptions behind this feature, I do not see this to be resolved by a simple fix. Would you consider changing the default setting for this to false?

        Show
        Aditya Kishore added a comment - As someone who ran into different facet of this issue with different projects, I have documented my findings here: http://bcn.adityakishore.com/2014/11/broken-incremental-compilation-with.html With current assumptions behind this feature, I do not see this to be resolved by a simple fix. Would you consider changing the default setting for this to false ?
        Hide
        Alexander Kriegisch added a comment -

        May I be so bold to ask why this issue has a major priority but has not received any attention in more than one year? It could have been fixed for 3.2, but that chance has passed. Maybe 3.3?

        Maybe it makes sense to check the single commit by Olivier Lamy which introduced the useIncrementalCompilation switch and check the if-else branches in order to find out why it works for false, but not for true. Possibly this is because a set of stale sources is computed in the false case. Shouldn't that rather be done for true? I do not really understand the code, I just took a quick look.

        Show
        Alexander Kriegisch added a comment - May I be so bold to ask why this issue has a major priority but has not received any attention in more than one year? It could have been fixed for 3.2, but that chance has passed. Maybe 3.3? Maybe it makes sense to check the single commit by Olivier Lamy which introduced the useIncrementalCompilation switch and check the if-else branches in order to find out why it works for false , but not for true . Possibly this is because a set of stale sources is computed in the false case. Shouldn't that rather be done for true ? I do not really understand the code, I just took a quick look.
        Hide
        Lukas Eder added a comment -

        Agh. I wish I had checked for a potential bug here earlier! Would have saved me hours of waiting for the compiler to complete. So. What's with the fix priority, then?

        Show
        Lukas Eder added a comment - Agh. I wish I had checked for a potential bug here earlier! Would have saved me hours of waiting for the compiler to complete. So. What's with the fix priority, then?
        Hide
        Jens Bannmann added a comment -

        Olivier Lamy (*$^¨%`£), could you please have a look at this?

        Show
        Jens Bannmann added a comment - Olivier Lamy (*$^¨%`£) , could you please have a look at this?

          People

          • Assignee:
            Unassigned
            Reporter:
            Michael Ekstrand
          • Votes:
            35 Vote for this issue
            Watchers:
            36 Start watching this issue

            Dates

            • Created:
              Updated:

              Development