Description
I have a situation where leaf application modules in a multi-module/Reactor build target Java 11, but a particular module needs to continue being able to run in Java 8 runtime environments, thus other library modules in the build that it depends on must also target 8.
I hoped that the enforceBytecodeVersion
rule in extra-enforcer-rules
would help to enforce this, but I tried the following configuration and the rule does not fail when class files of other modules that the one in question depends on are verifiably built with <release>11</release>
/ show major bytecode version 55 from javap
.
<executions>
<execution>
<id>enforce-bytecode-version</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<enforceBytecodeVersion>
<maxJdkVersion>1.8</maxJdkVersion>
</enforceBytecodeVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
(also tried <maxJavaMajorVersionNumber>52</maxJavaMajorVersionNumber>
)
So from cursory appearance, it seems the rule does not consider Reactor module dependencies. I didn't check implementation, I'm not acquainted with Maven plugin APIs, so apologies if I'm overlooking something.
Activity