You are viewing the docs for v1.3, which is not the latest release.
View latest

Update Custom Plugins for Micronaut 4.3 Compatibility

For the complete documentation index, see llms.txt. For a full content snapshot, see llms-full.txt. Append .md to any kestra.io/docs/* URL for plain Markdown.

Migration to Micronaut 4.3

Kestra 0.15.0 has been migrated to Micronaut 4.3 for improved security. This page explains how to make your custom plugins compatible with this new version.

Custom plugins need to be migrated to Micronaut 4.3 to be compatible with Kestra 0.15.0 and later.

Upgrade your gradle.properties to the following library versions:

propertiesversion=0.15.0-SNAPSHOT
kestraVersion=[0.15,)
micronautVersion=4.3.0
lombokVersion=1.18.30

In gradle.build, update the dependencies as follows:

groovydependencies {
    // lombok
    annotationProcessor "org.projectlombok:lombok:$lombokVersion"
    compileOnly "org.projectlombok:lombok:$lombokVersion"

    // micronaut
    annotationProcessor platform("io.micronaut.platform:micronaut-platform:$micronautVersion")
    annotationProcessor "io.micronaut:micronaut-inject-java"
    annotationProcessor "io.micronaut.validation:micronaut-validation-processor"

    compileOnly platform("io.micronaut.platform:micronaut-platform:$micronautVersion")
    compileOnly "io.micronaut:micronaut-inject"
    compileOnly "io.micronaut.validation:micronaut-validation"

    // kestra
    compileOnly group: "io.kestra", name: "core", version: kestraVersion

    // other libs go here
}

Some libraries are no longer included by default in Micronaut 4.3. For instance:

  • if you use Jackson in your custom plugin, you need to add compileOnly "io.micronaut:micronaut-jackson-databind"
  • if you use the HTTP client, you need to add compileOnly "io.micronaut:micronaut-http-client".

Remove the following Gradle configuration, as Kestra now uses SLF4J 2:

groovyconfigurations.all {
    resolutionStrategy {
        force("org.slf4j:slf4j-api:1.7.36")
    }
}

Test dependencies require an adjustment as well:

groovydependencies {
    // lombok
    testAnnotationProcessor "org.projectlombok:lombok:" + lombokVersion
    testCompileOnly 'org.projectlombok:lombok:' + lombokVersion

    // micronaut
    testAnnotationProcessor platform("io.micronaut.platform:micronaut-platform:$micronautVersion")
    testAnnotationProcessor "io.micronaut:micronaut-inject-java"
    testAnnotationProcessor "io.micronaut.validation:micronaut-validation-processor"

    testImplementation platform("io.micronaut.platform:micronaut-platform:$micronautVersion")
    testImplementation "io.micronaut.test:micronaut-test-junit5"

    // test deps needed only for to have a runner
    testImplementation group: "io.kestra", name: "core", version: kestraVersion
    testImplementation group: "io.kestra", name: "repository-memory", version: kestraVersion
    testImplementation group: "io.kestra", name: "runner-memory", version: kestraVersion
    testImplementation group: "io.kestra", name: "storage-local", version: kestraVersion

    // test
    testImplementation "org.junit.jupiter:junit-jupiter-engine"
    testImplementation "org.hamcrest:hamcrest:2.2"
    testImplementation "org.hamcrest:hamcrest-library:2.2"
}

Jakarta migration

Adjust the imports from javax.* to jakarta.* — this is due to the migration from Java EE to Jakarta EE.

Some IDEs do this automatically. For example, IntelliJ has a command Refactor -> Migrate Packages and Classes -> Java EE to Jakarta EE). Alternatively, you can use the OpenRewrite project.

Project Reactor migration

Our reactive stack has been migrated from the deprecated RxJava 2 to the Project Reactor.

If your plugin uses RxJava, migrate it to Project Reactor.

Replace the library io.micronaut.rxjava2:micronaut-rxjava2 by io.micronaut.reactor:micronaut-reactor.

Then, update your code to use the Project Reactor types:

  • Flux (instead of Flowable)
  • Mono (instead of Single).

Lastly, if you were using the reactive HTTP client, replace io.micronaut.rxjava2:micronaut-rxjava2-http-client with io.micronaut.reactor:micronaut-reactor-http-client.