CtrlK
BlogDocsLog inGet started
Tessl Logo

giuseppe-trisciuoglio/developer-kit

Comprehensive developer toolkit providing reusable skills for Java/Spring Boot, TypeScript/NestJS/React/Next.js, Python, PHP, AWS CloudFormation, AI/RAG, DevOps, and more.

82

Quality

82%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Risky

Do not use without reviewing

Validation failed for skills in this tile
One or more skills have errors that need to be fixed before they can move to Implementation and Discovery review.
Overview
Quality
Evals
Security
Files

gradle-native-plugin.mdplugins/developer-kit-java/skills/graalvm-native-image/references/

Gradle GraalVM Native Build Tools Plugin

Complete Gradle configuration for building GraalVM native images using the Native Build Tools plugin.

Table of Contents

  1. Plugin Setup
  2. Configuration Options
  3. Spring Boot Gradle Integration
  4. Testing in Native Mode
  5. Multi-Project Builds

Plugin Setup

Kotlin DSL (build.gradle.kts)

plugins {
    java
    id("org.graalvm.buildtools.native") version "0.10.6"
}

graalvmNative {
    binaries {
        named("main") {
            imageName.set(project.name)
            mainClass.set("com.example.Application")
            buildArgs.add("--no-fallback")
            buildArgs.add("-H:+ReportExceptionStackTraces")
            javaLauncher.set(javaToolchains.launcherFor {
                languageVersion.set(JavaLanguageVersion.of(21))
                vendor.set(JvmVendorSpec.matching("GraalVM"))
            })
        }
    }
}

Groovy DSL (build.gradle)

plugins {
    id 'java'
    id 'org.graalvm.buildtools.native' version '0.10.6'
}

graalvmNative {
    binaries {
        main {
            imageName = project.name
            mainClass = 'com.example.Application'
            buildArgs.add('--no-fallback')
            buildArgs.add('-H:+ReportExceptionStackTraces')
        }
    }
}

Build with:

./gradlew nativeCompile

The native executable is produced in build/native/nativeCompile/.

Configuration Options

Binary Configuration

graalvmNative {
    binaries {
        named("main") {
            imageName.set(project.name)
            mainClass.set("com.example.Application")

            // Build arguments
            buildArgs.addAll(
                "--no-fallback",
                "-H:+ReportExceptionStackTraces",
                "--enable-https",
                "-J-Xmx8g"
            )

            // Quick build mode (faster build, slower runtime — dev only)
            quickBuild.set(false)

            // Rich output during build
            richOutput.set(true)

            // Verbose output
            verbose.set(true)

            // Resource includes
            resources {
                autodetect()
                includedPatterns.add("application.*")
                includedPatterns.add("META-INF/.*")
            }
        }
    }

    // GraalVM metadata repository
    metadataRepository {
        enabled.set(true)
        version.set("0.3.14")
    }

    // Toolchain detection
    toolchainDetection.set(true)
}

Java Toolchain Configuration

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(21))
    }
}

graalvmNative {
    binaries {
        named("main") {
            javaLauncher.set(javaToolchains.launcherFor {
                languageVersion.set(JavaLanguageVersion.of(21))
                vendor.set(JvmVendorSpec.matching("GraalVM Community"))
            })
        }
    }
}

Spring Boot Gradle Integration

For Spring Boot 3.x projects with Gradle:

plugins {
    java
    id("org.springframework.boot") version "3.4.1"
    id("io.spring.dependency-management") version "1.1.7"
    id("org.graalvm.buildtools.native") version "0.10.6"
}

// Spring Boot plugin automatically configures AOT processing
// when GraalVM Native Image plugin is detected

Build commands:

# Compile to native executable
./gradlew nativeCompile

# Build OCI image with Cloud Native Buildpacks
./gradlew bootBuildImage

# Run the native executable
./build/native/nativeCompile/<app-name>

# Run AOT processing only
./gradlew processAot

Custom AOT Configuration

tasks.withType<org.springframework.boot.gradle.tasks.aot.ProcessAot>().configureEach {
    args("--spring.profiles.active=prod")
}

graalvmNative {
    binaries {
        named("main") {
            buildArgs.addAll(
                "--no-fallback",
                "-H:+ReportExceptionStackTraces"
            )
        }
    }
}

Testing in Native Mode

Run JUnit tests compiled as a native executable:

./gradlew nativeTest

Configure test binary:

graalvmNative {
    binaries {
        named("test") {
            buildArgs.addAll(
                "--no-fallback",
                "-H:+ReportExceptionStackTraces"
            )
        }
    }

    // Configure test support
    testSupport.set(true)
}

Multi-Project Builds

For multi-project Gradle builds, apply the plugin only in the executable subproject:

// settings.gradle.kts
pluginManagement {
    plugins {
        id("org.graalvm.buildtools.native") version "0.10.6"
    }
}

// app/build.gradle.kts (executable subproject)
plugins {
    id("org.graalvm.buildtools.native")
}

graalvmNative {
    binaries {
        named("main") {
            imageName.set("my-app")
            mainClass.set("com.example.Application")
        }
    }
}

plugins

developer-kit-java

skills

README.md

tile.json