matrei commented on code in PR #15411:
URL: https://github.com/apache/grails-core/pull/15411#discussion_r2833257948
##########
grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy:
##########
@@ -376,10 +379,13 @@ class GrailsGradlePlugin extends GroovyPlugin {
}
}
- project.logger.info('Adding Micronaut annotationProcessor
dependencies to project {}', project.name)
- project.getDependencies().add('annotationProcessor',
project.dependencies.platform("io.micronaut.platform:micronaut-platform:$micronautPlatformVersion"))
- project.getDependencies().add('annotationProcessor',
'io.micronaut:micronaut-inject-java')
- project.getDependencies().add('annotationProcessor',
'jakarta.annotation:jakarta.annotation-api')
+ project.logger.info('Configuring CLASSIC boot loader for Micronaut
compatibility in {}', project.name)
+ project.tasks.withType(BootJar).configureEach { BootJar bootJar ->
+
bootJar.loaderImplementation.convention(LoaderImplementation.CLASSIC)
+ }
+ project.tasks.withType(BootWar).configureEach { BootWar bootWar ->
+
bootWar.loaderImplementation.convention(LoaderImplementation.CLASSIC)
+ }
Review Comment:
```suggestion
project.tasks.withType(BootArchive).configureEach {
it.loaderImplementation.convention(LoaderImplementation.CLASSIC)
}
```
##########
grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/build/gradle/templates/buildGradle.rocker.raw:
##########
@@ -107,6 +107,17 @@ bootRun {
}
+@if (features.contains("grails-micronaut")) {
+tasks.named('bootJar') {
+ loaderImplementation =
org.springframework.boot.loader.tools.LoaderImplementation.CLASSIC
+}
+
+tasks.named('bootWar') {
+ loaderImplementation =
org.springframework.boot.loader.tools.LoaderImplementation.CLASSIC
+}
+
+}
+
Review Comment:
Do we still need these here, even if they are configured by the
`GrailsGradlePlugin`?
##########
grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy:
##########
@@ -71,7 +71,10 @@ import
org.springframework.boot.gradle.dsl.SpringBootExtension
import org.springframework.boot.gradle.plugin.ResolveMainClassName
import org.springframework.boot.gradle.plugin.SpringBootPlugin
import org.springframework.boot.gradle.tasks.bundling.BootArchive
+import org.springframework.boot.gradle.tasks.bundling.BootJar
+import org.springframework.boot.gradle.tasks.bundling.BootWar
Review Comment:
```suggestion
```
##########
grails-doc/src/en/guide/upgrading/upgrading60x.adoc:
##########
@@ -371,6 +371,12 @@ Here's an example `gradle.properties` file:
micronautPlatformVersion=4.9.2
----
+Please note that, due to
https://github.com/micronaut-projects/micronaut-spring/issues/769[this issue],
Spring Boot DevTools does not work with the Micronaut integration.
+
+IMPORTANT: Do **not** manually add Micronaut annotation processors (such as
`micronaut-inject-java`) to your `build.gradle`. The Grails Gradle Plugin
automatically configures the correct annotation processor for Java source files
and uses Groovy AST transforms (`micronaut-inject-groovy`) for Groovy source
files. Manually adding annotation processors may cause duplicate bean
definitions or incremental compilation issues (see
https://github.com/apache/grails-core/issues/15211[#15211]).
Review Comment:
Is this still correct?
--
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]