[ https://issues.apache.org/jira/browse/MCOMPILER-578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17823752#comment-17823752 ]
Alan Zimmer commented on MCOMPILER-578: --------------------------------------- Here is a small GH repo: https://github.com/alzimmermsft/MCOMPILER-578-repro > 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 > Priority: Major > > 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. > > <configuration> > <showWarnings>true</showWarnings> > <failOnWarning>true</failOnWarning> > <skipMain>${skipCompile}</skipMain> > <skip>${skipTestCompile}</skip> > <compilerArgs combine.children="append" combine.self="append"> > <!-- > https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html#xlintwarnings > --> > <arg>-Xlint:cast</arg> > <arg>-Xlint:classfile</arg> > <arg>-Xlint:${compiler.failondeprecatedstatus}deprecation</arg> > <arg>-Xlint:dep-ann</arg> > <arg>-Xlint:divzero</arg> > <arg>-Xlint:empty</arg> > <arg>-Xlint:fallthrough</arg> > <arg>-Xlint:finally</arg> > <arg>-Xlint:options</arg> > <arg>-Xlint:overrides</arg> > <arg>-Xlint:path</arg> > <!-- <arg>-Xlint:processing</arg> --> > <arg>-Xlint:rawtypes</arg> > <!-- <arg>-Xlint:serial</arg> --> > <arg>-Xlint:static</arg> > <arg>-Xlint:try</arg> > <arg>-Xlint:unchecked</arg> > <arg>-Xlint:varargs</arg> > </compilerArgs> > <!-- Default is annotation processing being off. --> > <proc>${compiler.proc}</proc> > <createMissingPackageInfoClass>false</createMissingPackageInfoClass> > </configuration> > <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)