Skip to content

Instantly share code, notes, and snippets.

@melix
Created December 20, 2021 17:49
Show Gist options
  • Save melix/7af0168646df0f2626b96ce153a285e5 to your computer and use it in GitHub Desktop.
Save melix/7af0168646df0f2626b96ce153a285e5 to your computer and use it in GitHub Desktop.
Testing Micronaut AOT for Lambda

Edit your settings.gradle file to include the Micronaut Gradle Plugin branch:

plugins {
    id 'me.champeau.includegit' version '0.1.4'
}

rootProject.name="micronautguide"

gitRepositories {
    include('micronaut-gradle-plugin') {
        uri = 'git@github.com:micronaut-projects/micronaut-gradle-plugin.git'
        branch = 'cc/aot-support-micronaut-library'
    }
}
  1. edit your build.gradle file to include the AOT plugin:
plugins {
    id("io.micronaut.library") version "3.1.1-SNAPSHOT"
    id("com.github.johnrengelman.shadow") version "7.1.0"
    id("io.micronaut.aot") version "3.1.1-SNAPSHOT"    
}

micronaut {
    aot {
        cacheEnvironment.set(true)
        optimizeServiceLoading.set(true)
        optimizeClassLoading.set(true)
        convertYamlToJava.set(true)
        precomputeOperations.set(true)
    }
}
  1. run ./gradlew optimizedJitJar (or optimizedJitJarAll if you are using the shadow plugin)

  2. profit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment