jamesfredley commented on PR #15677:
URL: https://github.com/apache/grails-core/pull/15677#issuecomment-4568577801

   ## Forge behavior: the `grails-micronaut` feature and Java versions
   
   Documenting the current Forge behavior (asked about earlier - it was already 
in place on this branch, committed in `5f94d86f79`).
   
   ### What happens
   
   When the `grails-micronaut` feature is selected in Grails Forge (CLI, web 
UI, or API) and the requested target JDK is **below 25**, app generation is 
**rejected** - no project is produced. The feature's `processSelectedFeatures` 
hook throws:
   
   ```
   grails-micronaut requires JDK 25 or later (selected: JDK <NN>).
   ```
   
   Selecting the feature with JDK 25+ generates the app normally.
   
   ### Where it is enforced
   
   `org.grails.forge.feature.micronaut.GrailsMicronaut#processSelectedFeatures`:
   
   ```java
   JdkVersion jdk = featureContext.getJavaVersion();
   if (jdk.majorVersion() < JdkVersion.JDK_25.majorVersion()) {
       throw new IllegalArgumentException(
           getName() + " requires JDK 25 or later (selected: JDK " + 
jdk.majorVersion() + ").");
   }
   ```
   
   ### Why JDK 25
   
   `micronaut-core`'s `ScopedValues` references 
`java.lang.ScopedValue.CallableOp`, which only exists on JDK 25+ (JEP 506). 
More broadly, the Micronaut 5.0.0 GA platform bumped in this PR publishes JARs 
with `org.gradle.jvm.version=25` and JVM 25 bytecode. This is the same 
constraint that drives the consumer-side note in the PR description: the 
published `grails-micronaut:8.0.0` artifact carries 
`org.gradle.jvm.version=25`, so Grails 8 apps on JDK 21 cannot resolve it. 
Forge fails fast at generation time rather than letting users discover the 
incompatibility at build time.
   
   ### Related Forge validation
   
   `GrailsMicronautValidator#validatePreProcessing` additionally rejects 
combining `grails-micronaut` with Spring Boot DevTools (see 
micronaut-projects/micronaut-spring#769):
   
   ```
   Spring Boot DevTools are not supported with Grails Micronaut
   ```
   
   ### Note on test coverage
   
   The JDK 25 guard itself currently has no dedicated negative test - existing 
specs that exercise `grails-micronaut` simply supply `JdkVersion.JDK_25` so 
they pass. If desired, I can add a Forge spec asserting that selecting 
`grails-micronaut` with a sub-25 JDK throws the expected 
`IllegalArgumentException`. Let me know and I'll include it.
   


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