Uploaded image for project: 'Maven Compiler Plugin'
  1. Maven Compiler Plugin
  2. MCOMPILER-474

Dependent modules are not recompiled if we run the "package" goal

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.8.1
    • 3.10.0
    • None

    Description

      Suppose we have a project with two modules: "Lib" and "App", App depends on Lib. And we ran mvn clean install earlier. Then we changed something in Lib sources. Now consider these two scenarios:

      • If we run mvn compile: Lib gets recompiled, then App gets recompiled - all good.
      • If we run mvn package: Lib gets recompiled, but App doesn't ("Nothing to compile - all classes are up to date") - a bug.

      The problem here is that if the current build requests packaging a jar then Lib is added to App's compilePath as .../lib/target/lib-x.y.z.jar (instead of .../lib/target/classes in case of "compile" goal). And the isDependencyChanged() function in AbstractCompilerMojo only checks class files, not jars.

      This can be reproduced using the existing integration test https://github.com/apache/maven-compiler-plugin/tree/master/src/it/MCOMPILER-349_dependencyChanged, you'll just need to replace "compile" with "package" in the invoker.properties file.

      Attachments

        Issue Links

          Activity

            People

              olamy Olivier Lamy
              kozlovr Roman Kozlov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: