-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Micronaut 5 Module Checklist
This pull request highlights most of the changes required in the checklist
- Update to Gradle 9.1
- Update to the latest release of Micronaut Gradle Build Plugin.
- Update Micronaut Build to 8.0.0-M6
- Update to Kotlin 2.2.20.
- Use JUnit from Micronaut Test
- Add Junit Platform
- Update baseline to 21
- Update GitHub Actions Java baselines and force GraalVM GitHub Action to use 21
- Update KSP Gradle Version to latest stable version
- If the module uses the shadow plugin, update it to the new shadow plugin. Instead of
gradle.plugin.com.github.johnrengelman:shadow, it should becom.gradleup.shadow:shadow-gradle-plugin. - Failed to load JUnit Platform
- If the module defines:
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}Remove it (we must not use toolchains).
- Use instead:
eg for Java baseline : plugin-> id "io.micronaut.build.internal.java-base" for kotlin baseline : plugin -> id "io.micronaut.build.internal.kotlin-base"
-
if the build fails test compilation, most likely tests were accidentally using JUnit 4 annotations or assertions. Use JUnit 5 : change test imports
-
In order to use the default Groovy, Micronaut Docs, Micronaut Test, Micronaut Logging, Spock, JUnit versions remove from
gradle/libs.versions.toml:
-micronaut-docs = "3.0.0"
-micronaut-test = "4.9.0"
-groovy = "4.0.13"
-spock = "2.3-groovy-4.0"
-junit5 = "5.14.0"
kotlin = "2.2.21"
-micronaut-logging = "1.7.1"- Java 25 introduces java.lang.IO, so if a Groovy test uses
@ExecuteOn(IO)it will fail compilation even with a static import.
Micronaut 5 modules should replace Micronaut Nullability annotations with JSpecify Nullability annotations.
We need to replace usages of io.micronaut.core.annotation.Nullable with org.jspecify.annotations.Nullable and usages of io.micronaut.core.annotation.NonNull with org.jspecify.annotations.NonNull
When specifying the full qualified type, with Micronaut nullability annotations you could have:
public ReadBuffer adapt(@NonNull io.micronaut.core.io.buffer.ByteBuffer<?> buffer) {With JSpecify you need to have:
public ReadBuffer adapt(io.micronaut.core.io.buffer.@NonNull ByteBuffer<?> buffer) {
Inner classesFor inner classes, Micronaut annotations you could do:
public FileChangedEvent(@NonNull Path path, @NonNull WatchEvent.Kind eventType) {With JSpecify, you will need to do:
public FileChangedEvent(@NonNull Path path, WatchEvent.@NonNull Kind eventType) {micronaut-jackson-databind using Jackson 3. Check Jackson3 upgrade guide or Jackson 3 release notes.
You can also use the Upgrade from Jackson 2 to Jackson 3 open rewrite recipe.
plugins {
...
id("org.openrewrite.rewrite")
}
repositories {
mavenCentral()
}
rewrite {
activeRecipe("org.openrewrite.java.jackson.UpgradeJackson_2_3")
}
dependencies {
rewrite("org.openrewrite.recipe:rewrite-jackson:1.11.0")
compileOnly("tools.jackson.core:jackson-databind:2.17.2")-
Replace
com.fasterxml.jackson.databind.annotation.JsonDeserializewithtools.jackson.databind.annotation.JsonDeserialize. -
Replace
tools.jackson.databind.annotation.JsonPOJOBuilderwithtools.jackson.databind.annotation.JsonPOJOBuilder. -
Replace
com.fasterxml.jackson.databind.JsonNodewithtools.jackson.databind.JsonNode -
Replace
com.fasterxml.jackson.databind.node.JsonNodeFactorywithtools.jackson.databind.node.JsonNodeFactory -
Replace
com.fasterxml.jackson.databind.node.ObjectNodewithtools.jackson.databind.node.ObjectNode -
Replace
com.fasterxml.jackson.databind.ObjectMapperwithtools.jackson.databind.ObjectMapper -
Replace
com.fasterxml.jackson.databind.PropertyNamingStrategieswithtools.jackson.databind.PropertyNamingStrategies -
Replace
com.fasterxml.jackson.core.JsonParserwithtools.jackson.core.JsonParser. -
Replace
com.fasterxml.jackson.core.JsonTokenwithtools.jackson.core.JsonToken. -
Replace
com.fasterxml.jackson.core.JsonFactorywithtools.jackson.core.json.JsonFactory -
Replace
com.fasterxml.jackson.core.StreamWriteFeaturewithtools.jackson.core.StreamWriteFeature. -
Replace
com.fasterxml.jackson.core.json.JsonReadFeaturewithtools.jackson.core.json.JsonReadFeature. -
Replace
com.fasterxml.jackson.core.json.JsonWriteFeaturewithtools.jackson.core.json.JsonWriteFeature. -
Replace
com.fasterxml.jackson.core.JsonFactoryBuilderwithtools.jackson.core.json.JsonFactoryBuilder. -
Replace
com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider. withtools.jackson.databind.ser.std.SimpleFilterProvider -
Replace
com.fasterxml.jackson.core.JsonGeneratorwithtools.jackson.core.JsonGenerator. -
Replace
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitorwithtools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor. -
Replace
com.fasterxml.jackson.databind.ser.BeanPropertyWriterwithtools.jackson.databind.ser.BeanPropertyWriter. -
Replace
com.fasterxml.jackson.databind.ser.PropertyFilterwithtools.jackson.databind.ser.PropertyFilter. -
Replace
com.fasterxml.jackson.databind.ser.PropertyWriterwithtools.jackson.databind.ser.PropertyWriter.
exceptions
- Somes instances of
com.fasterxml.jackson.core.JsonParseExceptionare nowtools.jackson.core.JacksonException. -
com.fasterxml.jackson.databind.JsonMappingException(root for databind exceptions) becomestools.jackson.databind.DatabindException