Fork me on GitHub

Maven plugin to execute and package Micronaut applications.

This plugin has the following features:

  1. Running in development mode.

  2. Packaging an application into different formats: fat JAR, native image, Docker, etc.

  3. Generating Dockerfiles.

  4. Deploying Docker images to different registries.

  5. Using Micronaut AOT.

  6. Integration with Micronaut Test Resources.

  7. Integration with Micronaut OpenAPI.

Usage

Add the plugin to your build/plugins section:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <!-- ... -->
    <packaging>${packaging}</packaging>

    <properties>
        <!-- ... -->
        <packaging>jar</packaging>
        <micronaut.runtime>netty</micronaut.runtime>
    </properties>

    <build>
        <plugins>
            <!-- ... -->

            <plugin>
                <groupId>io.micronaut.maven</groupId>
                <artifactId>micronaut-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
Since version 4.0.0 of this plugin (which is the version compatible with Micronaut 4.x), the group id is io.micronaut.maven. Earlier versions compatible with Micronaut 3.x used io.micronaut.build.

The <packaging> part is important since the plugin support several packaging types. The default is jar.

For snapshot versions, you need the Sonatype OSSRH Snapshot repository:

<project>

    <!-- ... -->

    <pluginRepositories>

        <!-- ... -->

        <pluginRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
</project>