CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-springframework-boot--spring-boot-starter-parent

Parent pom providing dependency and plugin management for applications built with Maven

Pending
Overview
Eval results
Files

native.mddocs/

Native Compilation

GraalVM native image compilation support for creating native executables with fast startup times and low memory footprint, ideal for cloud-native deployments and serverless environments.

Capabilities

Native Profile

Maven profile that enables GraalVM native compilation with required plugin configurations.

/**
 * Native compilation profile for GraalVM native image creation
 * Activates additional plugin configurations for AOT processing
 */
<profile>
    <id>native</id>
    <build>
        <plugins>
            <!-- Native-specific plugin configurations -->
        </plugins>
    </build>
</profile>

Usage Examples:

# Build native executable
mvn -Pnative native:compile

# Build and test native executable
mvn -Pnative package

# Create native executable with specific name
mvn -Pnative native:compile -Dapp.name=my-native-app

JAR Plugin Native Configuration

Enhanced JAR plugin configuration for native compilation marker.

/**
 * Maven JAR plugin native configuration
 * Adds manifest entry indicating native processing
 */
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <archive>
            <manifestEntries>
                <Spring-Boot-Native-Processed>true</Spring-Boot-Native-Processed>
            </manifestEntries>
        </archive>
    </configuration>
</plugin>

Spring Boot AOT Processing

Spring Boot Maven plugin configuration for Ahead-of-Time compilation.

/**
 * Spring Boot Maven plugin AOT processing
 * Generates optimized code and configuration for native compilation
 */
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>process-aot</id>
            <goals>
                <goal>process-aot</goal>
            </goals>
        </execution>
    </executions>
</plugin>

GraalVM Native Maven Plugin

Core GraalVM native image plugin configuration for native executable creation.

/**
 * GraalVM native Maven plugin for native image compilation
 * Requires GraalVM 22.3 or later for Spring Boot native support
 */
<plugin>
    <groupId>org.graalvm.buildtools</groupId>
    <artifactId>native-maven-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <classesDirectory>${project.build.outputDirectory}</classesDirectory>
        <requiredVersion>22.3</requiredVersion>
    </configuration>
    <executions>
        <execution>
            <id>add-reachability-metadata</id>
            <goals>
                <goal>add-reachability-metadata</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Native Test Profile

Profile for running native tests to verify native compilation compatibility.

/**
 * Native test profile for testing native compilation
 * Includes JUnit Platform Launcher for native test execution
 */
<profile>
    <id>nativeTest</id>
    <dependencies>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <!-- Native test plugin configurations -->
        </plugins>
    </build>
</profile>

Spring Boot Native Test AOT

Spring Boot plugin configuration for native test AOT processing.

/**
 * Spring Boot Maven plugin for native test AOT processing
 * Optimizes test code for native test execution
 */
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>process-test-aot</id>
            <goals>
                <goal>process-test-aot</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Native Test Execution

GraalVM plugin configuration for executing tests in native mode.

/**
 * GraalVM native plugin for native test execution
 * Runs tests as native images to verify native compatibility
 */
<plugin>
    <groupId>org.graalvm.buildtools</groupId>
    <artifactId>native-maven-plugin</artifactId>
    <configuration>
        <classesDirectory>${project.build.outputDirectory}</classesDirectory>
        <requiredVersion>22.3</requiredVersion>
    </configuration>
    <executions>
        <execution>
            <id>native-test</id>
            <goals>
                <goal>test</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Native Compilation Workflow

Development Workflow

# Regular Spring Boot development
mvn spring-boot:run

# Test for native compatibility
mvn -PnativeTest test

# Build native executable
mvn -Pnative native:compile

# Run native executable
./target/my-app

Build Pipeline Integration

# Full native build with tests
mvn clean -Pnative package

# Native compilation only
mvn -Pnative clean compile native:compile

# Native test execution
mvn -PnativeTest clean test

# Build native executable with custom JVM arguments
mvn -Pnative native:compile -Dnative.build.args="--enable-preview,-H:+UnlockExperimentalVMOptions"

Docker Integration

# Multi-stage build for native executable
FROM ghcr.io/graalvm/graalvm-ce:java17 AS builder

WORKDIR /app
COPY pom.xml .
COPY src src

# Build native executable
RUN mvn -Pnative clean package

# Runtime stage
FROM scratch
COPY --from=builder /app/target/my-app /app
ENTRYPOINT ["/app"]

Native Configuration Hints

Application Properties for Native

# Native-specific configuration
spring.native.remove-unused-autoconfig=true
spring.aot.enabled=true

# GraalVM native image options
spring.graalvm.reachability-metadata.enabled=true

Native Hints in Code

@Configuration
@RegisterReflectionForBinding({User.class, Product.class})
public class NativeConfiguration {

    @Bean
    @RegisterReflectionForBinding(DatabaseConfig.class)
    public DataSource dataSource() {
        return new HikariDataSource();
    }
}

Runtime Hints

@Component
public class MyRuntimeHints implements RuntimeHintsRegistrar {
    
    @Override
    public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
        hints.reflection().registerType(MyClass.class, 
            MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
            MemberCategory.INVOKE_DECLARED_METHODS);
    }
}

Performance Characteristics

Native vs JVM Comparison

MetricJVMNative
Startup Time2-5 seconds50-200ms
Memory Usage100-500MB20-100MB
Peak PerformanceHigherLower
Build TimeFastSlow

Optimization Tips

<!-- Optimize for size -->
<plugin>
    <groupId>org.graalvm.buildtools</groupId>
    <artifactId>native-maven-plugin</artifactId>
    <configuration>
        <buildArgs>
            <buildArg>--no-fallback</buildArg>
            <buildArg>-H:+ReportExceptionStackTraces</buildArg>
            <buildArg>-H:+PrintGCDetails</buildArg>
            <buildArg>--enable-preview</buildArg>
        </buildArgs>
    </configuration>
</plugin>

Install with Tessl CLI

npx tessl i tessl/maven-org-springframework-boot--spring-boot-starter-parent

docs

index.md

native.md

plugins.md

properties.md

resources.md

tile.json