Alan Zimmer created MCOMPILER-578: ------------------------------------- Summary: Inconsistent behavior when clean is included in build Key: MCOMPILER-578 URL: https://issues.apache.org/jira/browse/MCOMPILER-578 Project: Maven Compiler Plugin Issue Type: Bug Affects Versions: 3.12.1 Reporter: Alan Zimmer
We use a set of compilation executions to make sure we compile our code to a baseline of Java 8 and for module-info.java specifically a baseline of Java 11, while also compiling to whatever version being used by the system (Java 17, 21, 22-ea, etc). After upgrading to 3.12.1 from 3.10.1 we found that when `clean` is included as part of the build we get a different behavior for the Java 11 compilation. When `clean` is included there is a compilation for that execution which recompiles the module-info down to a class level of 55.0, when clean isn't included the class level remains whatever level the JDK being used to compile is. <executions> <!-- compile first with VM's default Java version --> <!-- this will generate module-info with major class version based on the Java version being used, in CI this should be 61 (i.e Java 17) --> <execution> <id>default-compile</id> <goals> <goal>compile</goal> </goals> <configuration> <release>${java.vm.specification.version}</release> </configuration> </execution> <!-- then compile with Java 11 as the base version that supports module-info --> <!-- this is the Azure SDK baseline for jars that are released to Maven and should only be updated when the Azure SDK policy is changed --> <!-- executing this after default-compile will generate module-info with major class version 55 (i.e Java 11) --> <execution> <id>base-modules-compile</id> <goals> <goal>compile</goal> </goals> <configuration> <release>11</release> <includes> <include>module-info.java</include> </includes> </configuration> </execution> <!-- then compile without module-info for Java 8 --> <execution> <id>base-compile</id> <goals> <goal>compile</goal> </goals> <configuration> <compilerArgs combine.children="append"> <arg>-Xlint:-options</arg> <!-- Needed to compile with Java 20+ --> </compilerArgs> <release>8</release> <excludes> <exclude>module-info.java</exclude> </excludes> </configuration> </execution> -- This message was sent by Atlassian Jira (v8.20.10#820010)