desruisseaux commented on code in PR #1158:
URL: 
https://github.com/apache/maven-compiler-plugin/pull/1158#discussion_r4727786748


##########
pom.xml:
##########
@@ -188,10 +214,68 @@ under the License.
             <excludes>
               <exclude>unit/**</exclude>
             </excludes>
+            <!--
+              Tests run against the exploded classes directory, not the 
packaged JAR.
+              The JVM's multi-release JAR dispatch does not apply to 
directories, so
+              the JDK 24+ ByteCodeTransformer override must be placed before 
the root stub
+              on the classpath. We prepend META-INF/versions/24/ via the 
classesDirectory parameter
+              so it is resolved before target/classes/ by the bootstrap class 
loader.
+            -->
+            
<classesDirectory>${project.build.outputDirectory}/META-INF/versions/24</classesDirectory>
+            <additionalClasspathElements>
+              
<additionalClasspathElement>${project.build.outputDirectory}</additionalClasspathElement>
+            </additionalClasspathElements>
           </configuration>
         </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 ByteCodeTransformer, and runs on 
any JVM >= 17.
+                  -->
+                  <version>[25,)</version>

Review Comment:
   While the CI uses Java 25, the code only need Java 24.



-- 
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