gnodet-bot commented on code in PR #1144:
URL: 
https://github.com/apache/maven-compiler-plugin/pull/1144#discussion_r4134719240


##########
pom.xml:
##########
@@ -192,6 +192,60 @@ under the License.
         </plugin>
       </plugins>
     </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>enforce-java-build-version</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireJavaVersion>
+                  <!--
+                    Building this plugin requires JDK 25+ so that the 
java.lang.classfile
+                    classes in src/main/java24/ can always be compiled (with 
release=24).
+                    The compiled plugin JAR targets JDK 17 for main sources 
and JDK 24
+                    for the classfile-backed bytecode analyzer, and runs on 
any JVM >= 17.

Review Comment:
   🔴 **Critical — CI will break on JDK 8 and 21.** The shared workflow 
(`maven-verify.yml`) uses the default JDK matrix `[ "21", "25", "8" ]` from 
`apache/maven-gh-actions-shared@v5`, and this project doesn't override 
`jdk-matrix`. The enforcer requiring `[25,)` will fail the build on JDK 8 and 
21. The fail-fast job is `jdk-17-zulu`, which will also be rejected.
   
   Fix: add `jdk-matrix` override to `.github/workflows/maven-verify.yml`:
   
   ```yaml
   jobs:
     build:
       name: Verify
       uses: 
apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v5
       with:
         jdk-matrix: '[ "25" ]'
         jdk-distribution-matrix: '[ "temurin", "zulu", "microsoft" ]'
         maven4-build: true
         maven4-version: '4.0.0-rc-7'
         matrix-exclude: '[
           { "jdk": "25", "distribution": "microsoft"}
         ]'
   ```
   
   Alternatively, if you want the CI to also validate that the compiled JAR 
works on older JDKs, you could keep the multi-JDK matrix but add 
`-Denforcer.skip` for non-25 builds — though that's more complex and the 
enforcer is specifically there to fail-fast on unsupported build JDKs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to