Micronaut Launch

Generates Micronaut applications

Version: 4.3.6

1 Introduction

This project implements a project generator for Micronaut as is both a Command Line (CLI) application and an API that can be run as an HTTP server, deployed to a Servlet container or executed on a Serverless platform (Google Cloud Run, Google Cloud Function, AWS Lambda or Azure Function).

2 AWS CDK

Micronaut CDK modules simplify the creation of Lambda functions with Amazon Cloud Development Kit (CDK).

implementation("io.micronaut.starter:micronaut-starter-aws-cdk")
<dependency>
    <groupId>io.micronaut.starter</groupId>
    <artifactId>micronaut-starter-aws-cdk</artifactId>
</dependency>

2.1 MicronautFunctionFile

MicronautFunctionFile has a fluid API to ease generating the file name of the asset.

MicronautFunctionFile.builder()
        .buildTool(BuildTool.GRADLE)
        .archiveBaseName("app")
        .graalVMNative()
        .version("0.1")
        .build();

2.2 MicronautFunction

MicronautFunction eases the selection of the correct environment and sets the handler automatically.

boolean graalVMNative = false;
Function appFunction = MicronautFunction.create(ApplicationType.DEFAULT, graalVMNative, this, id)
        .architecture(Architecture.X86_64)
        .timeout(Duration.seconds(10))
        .memorySize(512)
        .tracing(Tracing.ACTIVE)
        .code(Code.fromAsset("../app/build/libs/" + MicronautFunctionFile.builder()
                .buildTool(BuildTool.MAVEN)
                .archiveBaseName("app")
                .version("0.1")
                .build()))
        .build();

If you use ApplicationType.FUNCTION you have to provide your handler.

Function.Builder builder = MicronautFunction.create(ApplicationType.FUNCTION, false, this, id)
        .handler("com.example.Handler");

3 Installation

3.1 Install with SDKMAN!

The best way to install Micronaut on Unix systems is with SDKMAN! which greatly simplifies installing and managing multiple Micronaut versions.

Before updating make sure you have the latest version of SDKMAN! installed. If not, run

$ sdk update

In order to install Micronaut, run following command:

$ sdk install micronaut

You can also specify the version to the sdk install command.

$ sdk install micronaut {project-version}

You can find more information about SDKMAN! usage on the SDKMAN! Docs

You should now be able to run the Micronaut CLI.

$ mn
| Starting interactive mode...
| Enter a command name to run. Use TAB for completion:
mn>

3.2 Install with Homebrew

In order to install Micronaut, run following command:

$ brew install --cask micronaut-projects/tap/micronaut

You can find more information about Homebrew usage on their homepage.

You should now be able to run the Micronaut CLI.

On macOS, you may get a warning message saying that “mn” cannot be opened because the developer cannot be verified.. To resolve it, click the Apple menu, and select System Settings. Then browse to Privacy & Security, and scroll down to the Security section. There should be a warning that "mn" was blocked, with an Allow Anyway button. Clicking this button will fix the issue.

See the Homebrew documentation for more details about this.

$ mn
| Starting interactive mode...
| Enter a command name to run. Use TAB for completion:
mn>

3.3 Install with MacPorts

Before installing, it is recommended to sync the latest Portfiles.

$ sudo port sync

In order to install Micronaut, run following command:

$ sudo port install micronaut

You can find more information about MacPorts usage on their homepage.

You should now be able to run the Micronaut CLI.

$ mn
| Starting interactive mode...
| Enter a command name to run. Use TAB for completion:
mn>

3.4 Install with Chocolatey

If using Windows, you can use Chocolatey to install the Micronaut CLI:

$ choco install micronaut

Check the micronaut package page for more information.

You should now be able to run the Micronaut CLI from the command prompt or Powershell by running mn:

$ mn
| Starting interactive mode...
| Enter a command name to run. Use TAB for completion:
mn>

3.5 Install through Binary on Windows

  • Download the latest binary from Micronaut Website

  • Extract the binary to appropriate location (For example: C:\micronaut)

  • Create an environment variable MICRONAUT_HOME which points to the installation directory i.e. C:\micronaut

  • Update the PATH environment variable, append %MICRONAUT_HOME%\bin.

You should now be able to run the Micronaut CLI from the command prompt as follows:

$ mn
| Starting interactive mode...
| Enter a command name to run. Use TAB for completion:
mn>

3.6 Build & Install from Source

Clone the repository as follows:

$ git clone https://github.com/micronaut-projects/micronaut-starter.git

cd into the micronaut-starter directory and run the following command:

$ ./gradlew micronaut-cli:assembleDist

This will create a zip distribution of the CLI (named with the current version) in the starter-cli/build/distributions/ folder.

You’ll need to unzip this somewhere convenient. For example, to unzip it to a dot directory in your user home, you could do:

$ mkdir ~/.micronaut
$ unzip starter-cli/build/distributions/micronaut-cli-VERSION.zip -d ~/.micronaut

In your shell profile (~/.bash_profile if you are using the Bash shell), export the MICRONAUT_HOME directory (wherever you unzipped it to) and add the CLI path to your PATH:

bash_profile/.bashrc
export MICRONAUT_HOME=~/path/to/unzipped/cli
export PATH="$PATH:$MICRONAUT_HOME/bin"
If you’re using SDKMAN! and don’t want to mess with your $MICRONAUT_HOME, you can also point SDKMAN! to your local installation for dev purposes by using sdk install micronaut dev path/to/unzipped/cli

Reload your terminal or source your shell profile with source:

$ source ~/.bash_profile

You are now able to run the Micronaut CLI.

$ mn
| Starting interactive mode...
| Enter a command name to run. Use TAB for completion:
mn>

4 Release History

2.0.0.M3

  • Initial Milestone Release

5 Available commands

Name

mn - Micronaut CLI command line interface for generating projects and services.

Synopsis

mn [-hvVx] [COMMAND]

Description

Micronaut CLI command line interface for generating projects and services. Application generation commands are:

  • create-app NAME

  • create-chatbot NAME

  • create-cli-app NAME

  • create-function-app NAME

  • create-grpc-app NAME

  • create-messaging-app NAME

Options

-h, --help

Show this help message and exit.

-v, --verbose

Create verbose output.

-V, --version

Print version information and exit.

-x, --stacktrace

Show full stack trace when exceptions occur.

Commands

create-app

Creates an application

create-chatbot

A guided walk-through to create a chat bot application

create-cli-app

Creates a CLI application

create-function-app

Creates a Cloud Function

create-grpc-app

Creates a gRPC application

create-messaging-app

Creates a messaging application

create

A guided walk-through to create an application

create-aws-lambda

A guided walk-through to create an lambda function

create-app

Name

mn-create-app - Creates an application

Synopsis

mn create-app [-hivVx] [--list-features] [-b=BUILD-TOOL] [--jdk=<javaVersion>] [-l=LANG] [-t=TEST] [-f=FEATURE[,FEATURE…​]]…​ [NAME]

Description

Creates an application

Options

-b, --build=BUILD-TOOL

Which build tool to configure. Possible values: gradle, gradle_kotlin, maven.

-f, --features=FEATURE[,FEATURE…​]

The features to use. Possible values: jdbc-tomcat, jdbc-ucp, jdbc-hikari, jdbc-dbcp, data-r2dbc, tomcat-server, groovy-xml, micronaut-aop, testcontainers, github-workflow-azure-container-instance-graalvm, tracing-jaeger, dekorate-halkyon, dekorate-kubernetes, jms-activemq-artemis, asciidoctor, discovery-eureka, data-jpa, elasticsearch, gradle-enterprise, github-workflow-oracle-cloud-functions-graalvm, config-consul, tracing-zipkin, reactor, cassandra, kotlin-extension-functions, views-pebble, oracle, jmx, liquibase, jul-to-slf4j, redoc, dekorate-knative, mqtt, azure-cosmos-db, object-storage-gcp, config-kubernetes, micrometer-graphite, slf4j-simple-logger, azure-key-vault, oracle-cloud-atp, email-template, google-cloud-workflow-ci, kubernetes, jasync-sql, object-storage-aws, rss-itunes-podcast, jib, dekorate-openshift, views-velocity, jobrunr-jobrunr, github-workflow-google-cloud-run, hamcrest, x86, aws-codebuild-workflow-ci, data-jdbc, openapi-adoc, github-workflow-ci, postgres, coherence, kafka-streams, jax-rs, rxjava3, views-jte, data-azure-cosmos, tracing-opentelemetry-exporter-logging, openapi, dekorate-servicecatalog, micrometer-new-relic, micrometer-observation, github-workflow-oracle-cloud-functions, micrometer-ganglia, localstack, redis-lettuce, netflix-archaius, cache-infinispan, groovy-yaml, object-storage-oracle-cloud, aws-parameter-store, oracle-cloud-sdk, slf4j-simple, mockito, views-handlebars, aws-lambda-events-serde, spring-web, undertow-server, micrometer-observation-http, dynamodb, micronaut-test-rest-assured, kafka, security-ldap, rabbitmq, micrometer-prometheus, jms-activemq-classic, aws-lambda, micrometer-signalfx, jetty-server, coherence-grpc-client, email-amazon-ses, cache-caffeine, groovy-json, github-workflow-azure-container-instance, amazon-api-gateway-http, micrometer-appoptics, jms-sqs, data-spring-jdbc, netflix-hystrix, aws-v2-sdk, r2dbc, gitlab-workflow-ci, serialization-jsonp, netty-server, micrometer-kairos, kubernetes-informer, mariadb, groovy-toml, netflix-ribbon, arm, views-soy, aws-secrets-manager, jooq, junit-platform-suite-engine, hibernate-validator, groovy-ginq, micrometer-elastic, retry, aws-alexa, views-rocker, test-resources, email-postmark, email-sendgrid, views-freemarker, coherence-distributed-configuration, oracle-cloud-vault, gcp-cloud-trace, flyway, logback, vertx-pg-client, micrometer-dynatrace, micrometer-annotation, micrometer-humio, jackson-databind, email-mailjet, sqlserver, github-workflow-google-cloud-run-graalvm, micronaut-http-validation, websocket, spring-data-jpa, micrometer-datadog, discovery-consul, hibernate-reactive-jpa, graphql, kubernetes-rxjava2-client, views-thymeleaf, sql-jdbi, http-client-jdk, mongo-sync, http-session, groovy-datetime, control-panel, hibernate-jpa, tracing-opentelemetry-zipkin, chatbots-basecamp-http, eclipsestore, awaitility, h2, data-mongodb-reactive, chatbots-telegram-http, swagger-ui, jms-oracle-aq, tracing-opentelemetry-jaeger, knative, annotation-api, micrometer-jmx, openrewrite, amazon-cognito, views-fieldset, security-jwt, groovy-dateutil, github-workflow-graal-docker-registry, micrometer-wavefront, rxjava2, kubernetes-reactor-client, microstream-cache, eclipsestore-rest, acme, tracing-opentelemetry-xray, jms-core, buildless, multi-tenancy, coherence-data, gcp-pubsub, jrebel, rxjava1, micrometer-atlas, data-mongodb, graalvm, microstream, rxjava2-http-client, object-storage-azure, junit-params, google-cloud-function, jackson-xml, vertx-mysql-client, mqtt-hivemq, github-workflow-docker-registry, cache-hazelcast, spring-boot, neo4j-bolt, lombok, management, oci-devops-build-ci, micronaut-aot, mockserver-client-java, cache-coherence, reactor-http-client, micrometer-azure-monitor, micrometer-cloudwatch, spring, assertj, serialization-jackson, mysql, http-client, serialization-bson, groovy-sql, coherence-session, micrometer-influx, kapt, dekorate-jaeger, problem-json, spring-data-jdbc, aws-lambda-custom-runtime, log4j2, kubernetes-client, rss, azure-function, rxjava3-http-client, discovery-client, oracle-function, tracing-opentelemetry-exporter-otlp, rapidoc, gcp-secrets-manager, mqttv3, tracing-opentelemetry-gcp, microstream-rest, security, micrometer-statsd, email-javamail, dekorate-prometheus, micrometer-stackdriver, amazon-api-gateway, data-hibernate-reactive, micrometer-oracle-cloud, cache-ehcache, object-storage-local, discovery-core, nats, mongo-reactive, crac, ksp, discovery-kubernetes, validation, security-oauth2, security-session, aws-cdk, ktor, shade, toml, yaml, config4k, properties

-h, --help

Show this help message and exit.

-i, --inplace

Create a service using the current directory

--jdk, --java-version=<javaVersion>

The JDK version the project should target. Possible values: 17, 21

-l, --lang=LANG

Which language to use. Possible values: java, groovy, kotlin.

--list-features

Output the available features and their descriptions

-t, --test=TEST

Which test framework to use. Possible values: junit, spock, kotest.

-v, --verbose

Create verbose output.

-V, --version

Print version information and exit.

-x, --stacktrace

Show full stack trace when exceptions occur.

Arguments

[NAME]

The name of the application to create.

create-cli-app

Name

mn-create-cli-app - Creates a CLI application

Synopsis

mn create-cli-app [-hivVx] [--list-features] [-b=BUILD-TOOL] [--jdk=<javaVersion>] [-l=LANG] [-t=TEST] [-f=FEATURE[, FEATURE…​]]…​ [NAME]

Description

Creates a CLI application

Options

-b, --build=BUILD-TOOL

Which build tool to configure. Possible values: gradle, gradle_kotlin, maven.

-f, --features=FEATURE[,FEATURE…​]

The features to use. Possible values: jdbc-tomcat, jdbc-ucp, jdbc-hikari, jdbc-dbcp, data-r2dbc, groovy-xml, micronaut-aop, testcontainers, github-workflow-azure-container-instance-graalvm, jms-activemq-artemis, asciidoctor, data-jpa, elasticsearch, gradle-enterprise, github-workflow-oracle-cloud-functions-graalvm, reactor, cassandra, kotlin-extension-functions, oracle, liquibase, jul-to-slf4j, mqtt, azure-cosmos-db, object-storage-gcp, slf4j-simple-logger, oracle-cloud-atp, email-template, google-cloud-workflow-ci, jasync-sql, object-storage-aws, jib, jobrunr-jobrunr, github-workflow-google-cloud-run, hamcrest, x86, aws-codebuild-workflow-ci, data-jdbc, github-workflow-ci, postgres, coherence, kafka-streams, rxjava3, data-azure-cosmos, github-workflow-oracle-cloud-functions, localstack, redis-lettuce, cache-infinispan, groovy-yaml, object-storage-oracle-cloud, oracle-cloud-sdk, slf4j-simple, mockito, aws-lambda-events-serde, dynamodb, micronaut-test-rest-assured, kafka, security-ldap, rabbitmq, jms-activemq-classic, coherence-grpc-client, email-amazon-ses, cache-caffeine, groovy-json, github-workflow-azure-container-instance, jms-sqs, data-spring-jdbc, netflix-hystrix, aws-v2-sdk, r2dbc, gitlab-workflow-ci, serialization-jsonp, kubernetes-informer, mariadb, groovy-toml, netflix-ribbon, arm, jooq, junit-platform-suite-engine, hibernate-validator, groovy-ginq, retry, test-resources, email-postmark, email-sendgrid, gcp-cloud-trace, flyway, logback, vertx-pg-client, jackson-databind, email-mailjet, sqlserver, github-workflow-google-cloud-run-graalvm, websocket, spring-data-jpa, hibernate-reactive-jpa, graphql, kubernetes-rxjava2-client, sql-jdbi, http-client-jdk, mongo-sync, http-session, groovy-datetime, hibernate-jpa, eclipsestore, awaitility, h2, data-mongodb-reactive, jms-oracle-aq, annotation-api, openrewrite, security-jwt, groovy-dateutil, github-workflow-graal-docker-registry, rxjava2, kubernetes-reactor-client, microstream-cache, eclipsestore-rest, jms-core, buildless, multi-tenancy, coherence-data, gcp-pubsub, jrebel, rxjava1, data-mongodb, graalvm, microstream, rxjava2-http-client, object-storage-azure, junit-params, jackson-xml, vertx-mysql-client, mqtt-hivemq, github-workflow-docker-registry, cache-hazelcast, spring-boot, neo4j-bolt, lombok, oci-devops-build-ci, mockserver-client-java, cache-coherence, reactor-http-client, spring, assertj, serialization-jackson, mysql, http-client, serialization-bson, groovy-sql, coherence-session, kapt, problem-json, spring-data-jdbc, log4j2, kubernetes-client, rxjava3-http-client, mqttv3, microstream-rest, security, email-javamail, data-hibernate-reactive, cache-ehcache, object-storage-local, nats, mongo-reactive, crac, ksp, validation, security-oauth2, security-session, shade, toml, yaml, config4k, properties

-h, --help

Show this help message and exit.

-i, --inplace

Create a service using the current directory

--jdk, --java-version=<javaVersion>

The JDK version the project should target. Possible values: 17, 21

-l, --lang=LANG

Which language to use. Possible values: java, groovy, kotlin.

--list-features

Output the available features and their descriptions

-t, --test=TEST

Which test framework to use. Possible values: junit, spock, kotest.

-v, --verbose

Create verbose output.

-V, --version

Print version information and exit.

-x, --stacktrace

Show full stack trace when exceptions occur.

Arguments

[NAME]

The name of the application to create.

create-function-app

Name

mn-create-function-app - Creates a Cloud Function

Synopsis

mn create-function-app [-hivVx] [--list-features] [-b=BUILD-TOOL] [--jdk=<javaVersion>] [-l=LANG] [-t=TEST] [-f=FEATURE[, FEATURE…​]]…​ [NAME]

Description

Creates a Cloud Function

Options

-b, --build=BUILD-TOOL

Which build tool to configure. Possible values: gradle, gradle_kotlin, maven.

-f, --features=FEATURE[,FEATURE…​]

The features to use. Possible values: jdbc-tomcat, jdbc-ucp, jdbc-hikari, jdbc-dbcp, data-r2dbc, groovy-xml, micronaut-aop, testcontainers, github-workflow-azure-container-instance-graalvm, tracing-jaeger, jms-activemq-artemis, asciidoctor, discovery-eureka, data-jpa, elasticsearch, gradle-enterprise, github-workflow-oracle-cloud-functions-graalvm, config-consul, tracing-zipkin, reactor, cassandra, kotlin-extension-functions, oracle, liquibase, jul-to-slf4j, chatbots-basecamp-azure-function, mqtt, azure-cosmos-db, object-storage-gcp, slf4j-simple-logger, azure-key-vault, oracle-cloud-atp, email-template, google-cloud-workflow-ci, jasync-sql, object-storage-aws, jib, jobrunr-jobrunr, github-workflow-google-cloud-run, hamcrest, x86, aws-codebuild-workflow-ci, data-jdbc, chatbots-telegram-azure-function, github-workflow-ci, postgres, coherence, kafka-streams, rxjava3, data-azure-cosmos, tracing-opentelemetry-exporter-logging, github-workflow-oracle-cloud-functions, localstack, redis-lettuce, netflix-archaius, cache-infinispan, groovy-yaml, object-storage-oracle-cloud, google-cloud-function-cloudevents, aws-parameter-store, oracle-cloud-sdk, slf4j-simple, mockito, aws-lambda-events-serde, dynamodb, micronaut-test-rest-assured, kafka, security-ldap, rabbitmq, jms-activemq-classic, aws-lambda, coherence-grpc-client, chatbots-telegram-lambda, email-amazon-ses, cache-caffeine, groovy-json, github-workflow-azure-container-instance, amazon-api-gateway-http, jms-sqs, data-spring-jdbc, netflix-hystrix, aws-v2-sdk, r2dbc, chatbots-telegram-gcp-function, gitlab-workflow-ci, serialization-jsonp, kubernetes-informer, mariadb, groovy-toml, netflix-ribbon, arm, aws-secrets-manager, jooq, chatbots-basecamp-gcp-function, junit-platform-suite-engine, hibernate-validator, groovy-ginq, aws-lambda-function-url, retry, aws-alexa, test-resources, email-postmark, email-sendgrid, coherence-distributed-configuration, oracle-cloud-vault, gcp-cloud-trace, flyway, logback, vertx-pg-client, jackson-databind, email-mailjet, sqlserver, github-workflow-google-cloud-run-graalvm, websocket, spring-data-jpa, discovery-consul, hibernate-reactive-jpa, graphql, kubernetes-rxjava2-client, sql-jdbi, http-client-jdk, mongo-sync, http-session, groovy-datetime, hibernate-jpa, tracing-opentelemetry-zipkin, eclipsestore, awaitility, h2, data-mongodb-reactive, jms-oracle-aq, tracing-opentelemetry-jaeger, annotation-api, openrewrite, security-jwt, groovy-dateutil, github-workflow-graal-docker-registry, rxjava2, kubernetes-reactor-client, microstream-cache, eclipsestore-rest, tracing-opentelemetry-xray, jms-core, buildless, multi-tenancy, coherence-data, gcp-pubsub, jrebel, rxjava1, data-mongodb, graalvm, microstream, rxjava2-http-client, object-storage-azure, junit-params, google-cloud-function, jackson-xml, vertx-mysql-client, mqtt-hivemq, github-workflow-docker-registry, cache-hazelcast, spring-boot, neo4j-bolt, lombok, oci-devops-build-ci, chatbots-basecamp-lambda, mockserver-client-java, cache-coherence, reactor-http-client, spring, assertj, serialization-jackson, mysql, http-client, aws-lambda-s3-event-notification, serialization-bson, groovy-sql, coherence-session, kapt, problem-json, spring-data-jdbc, aws-lambda-custom-runtime, log4j2, kubernetes-client, azure-function, rxjava3-http-client, discovery-client, oracle-function, tracing-opentelemetry-exporter-otlp, gcp-secrets-manager, mqttv3, aws-lambda-scheduled-event, tracing-opentelemetry-gcp, microstream-rest, security, email-javamail, amazon-api-gateway, data-hibernate-reactive, cache-ehcache, object-storage-local, discovery-core, nats, mongo-reactive, ksp, discovery-kubernetes, validation, security-oauth2, security-session, aws-cdk, shade, toml, yaml, config4k, properties

-h, --help

Show this help message and exit.

-i, --inplace

Create a service using the current directory

--jdk, --java-version=<javaVersion>

The JDK version the project should target. Possible values: 17, 21

-l, --lang=LANG

Which language to use. Possible values: java, groovy, kotlin.

--list-features

Output the available features and their descriptions

-t, --test=TEST

Which test framework to use. Possible values: junit, spock, kotest.

-v, --verbose

Create verbose output.

-V, --version

Print version information and exit.

-x, --stacktrace

Show full stack trace when exceptions occur.

Arguments

[NAME]

The name of the application to create.

create-grpc-app

Name

mn-create-grpc-app - Creates a gRPC application

Synopsis

mn create-grpc-app [-hivVx] [--list-features] [-b=BUILD-TOOL] [--jdk=<javaVersion>] [-l=LANG] [-t=TEST] [-f=FEATURE[, FEATURE…​]]…​ [NAME]

Description

Creates a gRPC application

Options

-b, --build=BUILD-TOOL

Which build tool to configure. Possible values: gradle, gradle_kotlin, maven.

-f, --features=FEATURE[,FEATURE…​]

The features to use. Possible values: jdbc-tomcat, jdbc-ucp, jdbc-hikari, jdbc-dbcp, data-r2dbc, groovy-xml, micronaut-aop, testcontainers, github-workflow-azure-container-instance-graalvm, tracing-jaeger, dekorate-halkyon, dekorate-kubernetes, jms-activemq-artemis, asciidoctor, discovery-eureka, data-jpa, elasticsearch, gradle-enterprise, github-workflow-oracle-cloud-functions-graalvm, config-consul, tracing-zipkin, reactor, cassandra, kotlin-extension-functions, oracle, liquibase, jul-to-slf4j, dekorate-knative, mqtt, azure-cosmos-db, object-storage-gcp, config-kubernetes, slf4j-simple-logger, azure-key-vault, oracle-cloud-atp, email-template, google-cloud-workflow-ci, kubernetes, jasync-sql, object-storage-aws, jib, dekorate-openshift, jobrunr-jobrunr, github-workflow-google-cloud-run, hamcrest, x86, aws-codebuild-workflow-ci, data-jdbc, github-workflow-ci, postgres, coherence, kafka-streams, rxjava3, data-azure-cosmos, tracing-opentelemetry-exporter-logging, dekorate-servicecatalog, github-workflow-oracle-cloud-functions, localstack, redis-lettuce, netflix-archaius, cache-infinispan, groovy-yaml, object-storage-oracle-cloud, aws-parameter-store, oracle-cloud-sdk, slf4j-simple, mockito, aws-lambda-events-serde, dynamodb, micronaut-test-rest-assured, kafka, security-ldap, rabbitmq, jms-activemq-classic, coherence-grpc-client, email-amazon-ses, cache-caffeine, groovy-json, github-workflow-azure-container-instance, jms-sqs, data-spring-jdbc, netflix-hystrix, aws-v2-sdk, r2dbc, gitlab-workflow-ci, serialization-jsonp, kubernetes-informer, mariadb, groovy-toml, netflix-ribbon, arm, aws-secrets-manager, jooq, junit-platform-suite-engine, hibernate-validator, groovy-ginq, retry, test-resources, email-postmark, email-sendgrid, coherence-distributed-configuration, oracle-cloud-vault, gcp-cloud-trace, flyway, logback, vertx-pg-client, jackson-databind, email-mailjet, sqlserver, github-workflow-google-cloud-run-graalvm, websocket, spring-data-jpa, discovery-consul, hibernate-reactive-jpa, graphql, kubernetes-rxjava2-client, sql-jdbi, http-client-jdk, mongo-sync, http-session, groovy-datetime, hibernate-jpa, tracing-opentelemetry-zipkin, eclipsestore, awaitility, h2, data-mongodb-reactive, jms-oracle-aq, tracing-opentelemetry-jaeger, knative, annotation-api, openrewrite, security-jwt, groovy-dateutil, github-workflow-graal-docker-registry, rxjava2, kubernetes-reactor-client, microstream-cache, eclipsestore-rest, tracing-opentelemetry-xray, jms-core, buildless, multi-tenancy, coherence-data, gcp-pubsub, jrebel, rxjava1, data-mongodb, graalvm, microstream, rxjava2-http-client, object-storage-azure, junit-params, jackson-xml, vertx-mysql-client, mqtt-hivemq, github-workflow-docker-registry, cache-hazelcast, spring-boot, neo4j-bolt, lombok, oci-devops-build-ci, mockserver-client-java, cache-coherence, reactor-http-client, spring, assertj, serialization-jackson, mysql, http-client, serialization-bson, groovy-sql, coherence-session, kapt, dekorate-jaeger, problem-json, spring-data-jdbc, log4j2, kubernetes-client, rxjava3-http-client, discovery-client, tracing-opentelemetry-exporter-otlp, gcp-secrets-manager, mqttv3, tracing-opentelemetry-gcp, microstream-rest, security, email-javamail, dekorate-prometheus, data-hibernate-reactive, cache-ehcache, object-storage-local, discovery-core, nats, mongo-reactive, ksp, discovery-kubernetes, validation, security-oauth2, security-session, shade, toml, yaml, config4k, properties

-h, --help

Show this help message and exit.

-i, --inplace

Create a service using the current directory

--jdk, --java-version=<javaVersion>

The JDK version the project should target. Possible values: 17, 21

-l, --lang=LANG

Which language to use. Possible values: java, groovy, kotlin.

--list-features

Output the available features and their descriptions

-t, --test=TEST

Which test framework to use. Possible values: junit, spock, kotest.

-v, --verbose

Create verbose output.

-V, --version

Print version information and exit.

-x, --stacktrace

Show full stack trace when exceptions occur.

Arguments

[NAME]

The name of the application to create.

create-messaging-app

Name

mn-create-messaging-app - Creates a messaging application

Synopsis

mn create-messaging-app [-hivVx] [--list-features] [-b=BUILD-TOOL] [--jdk=<javaVersion>] [-l=LANG] [-t=TEST] [-f=FEATURE[, FEATURE…​]]…​ [NAME]

Description

Creates a messaging application

Options

-b, --build=BUILD-TOOL

Which build tool to configure. Possible values: gradle, gradle_kotlin, maven.

-f, --features=FEATURE[,FEATURE…​]

The features to use. Possible values: jdbc-tomcat, jdbc-ucp, jdbc-hikari, jdbc-dbcp, data-r2dbc, groovy-xml, micronaut-aop, testcontainers, github-workflow-azure-container-instance-graalvm, tracing-jaeger, jms-activemq-artemis, asciidoctor, discovery-eureka, data-jpa, elasticsearch, gradle-enterprise, github-workflow-oracle-cloud-functions-graalvm, config-consul, tracing-zipkin, reactor, cassandra, kotlin-extension-functions, oracle, liquibase, jul-to-slf4j, mqtt, azure-cosmos-db, object-storage-gcp, config-kubernetes, slf4j-simple-logger, azure-key-vault, oracle-cloud-atp, email-template, google-cloud-workflow-ci, jasync-sql, object-storage-aws, jib, jobrunr-jobrunr, github-workflow-google-cloud-run, hamcrest, x86, aws-codebuild-workflow-ci, data-jdbc, github-workflow-ci, postgres, coherence, kafka-streams, rxjava3, data-azure-cosmos, tracing-opentelemetry-exporter-logging, github-workflow-oracle-cloud-functions, localstack, redis-lettuce, netflix-archaius, cache-infinispan, groovy-yaml, object-storage-oracle-cloud, aws-parameter-store, oracle-cloud-sdk, slf4j-simple, mockito, aws-lambda-events-serde, dynamodb, micronaut-test-rest-assured, kafka, security-ldap, rabbitmq, jms-activemq-classic, coherence-grpc-client, email-amazon-ses, cache-caffeine, groovy-json, github-workflow-azure-container-instance, jms-sqs, data-spring-jdbc, netflix-hystrix, aws-v2-sdk, r2dbc, gitlab-workflow-ci, serialization-jsonp, kubernetes-informer, mariadb, groovy-toml, netflix-ribbon, arm, aws-secrets-manager, jooq, junit-platform-suite-engine, hibernate-validator, groovy-ginq, retry, test-resources, email-postmark, email-sendgrid, coherence-distributed-configuration, oracle-cloud-vault, gcp-cloud-trace, flyway, logback, vertx-pg-client, jackson-databind, email-mailjet, sqlserver, github-workflow-google-cloud-run-graalvm, websocket, spring-data-jpa, discovery-consul, hibernate-reactive-jpa, graphql, kubernetes-rxjava2-client, sql-jdbi, http-client-jdk, mongo-sync, http-session, groovy-datetime, hibernate-jpa, tracing-opentelemetry-zipkin, eclipsestore, awaitility, h2, data-mongodb-reactive, jms-oracle-aq, tracing-opentelemetry-jaeger, annotation-api, openrewrite, security-jwt, groovy-dateutil, github-workflow-graal-docker-registry, rxjava2, kubernetes-reactor-client, microstream-cache, eclipsestore-rest, tracing-opentelemetry-xray, jms-core, buildless, multi-tenancy, coherence-data, gcp-pubsub, jrebel, rxjava1, data-mongodb, graalvm, microstream, rxjava2-http-client, object-storage-azure, junit-params, jackson-xml, vertx-mysql-client, mqtt-hivemq, github-workflow-docker-registry, cache-hazelcast, spring-boot, neo4j-bolt, lombok, oci-devops-build-ci, mockserver-client-java, cache-coherence, reactor-http-client, spring, assertj, serialization-jackson, mysql, http-client, serialization-bson, groovy-sql, coherence-session, kapt, problem-json, spring-data-jdbc, log4j2, kubernetes-client, rxjava3-http-client, discovery-client, tracing-opentelemetry-exporter-otlp, gcp-secrets-manager, mqttv3, tracing-opentelemetry-gcp, microstream-rest, security, email-javamail, data-hibernate-reactive, cache-ehcache, object-storage-local, discovery-core, nats, mongo-reactive, ksp, discovery-kubernetes, validation, security-oauth2, security-session, shade, toml, yaml, config4k, properties

-h, --help

Show this help message and exit.

-i, --inplace

Create a service using the current directory

--jdk, --java-version=<javaVersion>

The JDK version the project should target. Possible values: 17, 21

-l, --lang=LANG

Which language to use. Possible values: java, groovy, kotlin.

--list-features

Output the available features and their descriptions

-t, --test=TEST

Which test framework to use. Possible values: junit, spock, kotest.

-v, --verbose

Create verbose output.

-V, --version

Print version information and exit.

-x, --stacktrace

Show full stack trace when exceptions occur.

Arguments

[NAME]

The name of the application to create.

6 Micronaut Launch

The core functionality of the project generator is contained within the micronaut-starter-core subproject:

implementation("io.micronaut.starter:micronaut-starter-core:4.3.6")
<dependency>
    <groupId>io.micronaut.starter</groupId>
    <artifactId>micronaut-starter-core</artifactId>
    <version>4.3.6</version>
</dependency>

6.1 CLI Application

The subproject starter-cli provides an implementation that can be run as a Command Line Application (CLI).

Building Locally

From the project root:

./gradlew clean micronaut-cli:assemble

Now you can run the following the start the CLI in interactive mode:

java -jar starter-cli/build/libs/micronaut-cli-4.3.6-all.jar

Building a Native Image

Install GraalVM and Native Image. Follow the steps in the previous section to build the CLI and then run:

native-image --no-fallback -cp starter-cli/build/libs/micronaut-cli-4.3.6-all.jar

This will produce the mn executable which you can start with:

./mn

6.2 OpenAPI Specification

This project uses Micronaut OpenAPI support to generate an OpenAPI specification; a broadly adopted industry standard to describe APIs.

Run:

$ ./gradlew starter-api:classes

You can open the OPEN API specification in YAML format:

$ open starter-api/build/classes/java/main/META-INF/swagger/micronaut-launch-4.3.6.yml

6.3 Web API Application

The subproject starter-web-netty provides an implementation that runs on Netty.

Running the Application locally

From the project root:

./gradlew clean starter-web-netty:run

You can view the Swagger UI definition at:

Or with RapiDoc:

Deploying the Application

You can build the WAR file with:

./gradlew clean starter-web-netty:shadowJar

A runnable JAR file will be located in starter-web-servlet/build/libs:

$ java -jar starter-web-netty/build/libs/starter-web-netty-4.3.6-all.jar

6.4 Micronaut Launch React UI

The UI for Micronaut Launch is written in React and the sources can be found here as a separate project.

6.5 WAR Deployment

The subproject starter-web-servlet provides an implementation that can be deployed to any recent Servlet 4+ container (Tomcat 9, Jetty 9 etc).

Running the Application locally

From the project root:

./gradlew clean starter-web-servlet:run

You can view the Swagger UI definition at:

Or with RapiDoc:

Deploying the Application

You can build the WAR file with:

./gradlew clean starter-web-servlet:assemble

The WAR file will be located in starter-web-servlet/build/libs and can be deployed to any modern Servlet container (example Jetty 9 or Tomcat 9).

6.6 Google Cloud Run

The subproject starter-web-netty provides an implementation that can be continuously deployed to Cloud Run as a GraalVM native image.

Running the Application Locally

Install GraalVM and the native image tool and then run:

$ docker build . -t micronaut-starter -f DockerfileCloudRun
$ docker run -p 8080:8080 micronaut-starter

Continuous Deployment

Micronaut Starter is continuously deployed to Google Cloud Run as a native GraalVM application using GitHub Actions.

The Snapshot to GCR Workflow (defined by .github/workflows/gcr-snapshot.yml) deploys the application on each commit and the application can be accessed at the following URL:

Deploying the Application

To build and deploy the project yourself install set up the Google Cloud CLI then from the project root build the docker image and push it to Google Container Registry:

$ docker build . -t micronaut-starter -f DockerfileCloudRun
$ docker tag micronaut-starter gcr.io/[PROJECT ID]/micronaut-starter
$ docker push gcr.io/[PROJECT ID]/micronaut-starter

You are now ready to deploy your application:

$ gcloud beta run deploy --image gcr.io/[PROJECT ID]/micronaut-starter

Where [PROJECT ID] is replaced for your project ID. You should see output like the following:

Service name: (micronaut-starter):
Deploying container to Cloud Run service [micronaut-starter] in project [PROJECT_ID] region [us-central1]

✓ Deploying... Done.
  ✓ Creating Revision...
  ✓ Routing traffic...
Done.
Service [micronaut-starter] revision [micronaut-starter-00004] has been deployed and is serving traffic at https://micronaut-starter-xxxxxxx-uc.a.run.app

The URL is the URL of your Cloud Run application.

6.7 Google Cloud Function

The subproject starter-gcp-function provides a function that can be deployed to Google Cloud Function.

Running the Function Locally

To run the function locally run:

./gradlew clean starter-gcp-function:runFunction

Continuous Deployment

Micronaut Starter API is continuously deployed to Google Cloud Function as a Serverless Java application.

The Snapshot to GCF Workflow (defined by .github/workflows/gcf-snapshot.yml) deploys the application on each commit and the API can be accessed at the following URL:

Deploying the Function Yourself

To deploy the function first build the function with:

$ ./gradlew clean starter-gcp-function:shadowJar

Then cd into the starter-gcp-function/build/libs directory (deployment has to be done from the location where the JAR lives):

$ cd starter-gcp-function/build/libs

Now run:

$ gcloud alpha functions deploy micronaut-starter --entry-point io.micronaut.gcp.function.http.HttpFunction --runtime java17 --trigger-http

Choose unauthenticated access if you don’t need auth.

To obtain the trigger URL do the following:

$ YOUR_HTTP_TRIGGER_URL=$(gcloud alpha functions describe micronaut-starter --format='value(httpsTrigger.url)')

You can then use this variable to test the function invocation:

$ curl -i $YOUR_HTTP_TRIGGER_URL/create/app/example -o application.zip

6.8 AWS Lambda

The subproject starter-aws-lambda provides a function that can be deployed to AWS Lambda as a GraalVM native image.

Running the Lambda Locally

From the root of the project run:

$ docker build . -f DockerfileLambda -t micronaut-starter
$ mkdir -p build
$ docker run --rm --entrypoint cat micronaut-starter  /home/application/function.zip > build/function.zip

Then start the function with SAM (https://github.com/awslabs/aws-sam-cli).

$ sam local start-api --template sam-local.yml

Continuous Deployment

The Micronaut Starter API is continuously deployed by GitHub Actions to AWS Lambda as a Serverless GraalVM native application using a custom AWS Lambda Runtime .

The Snapshot to AWS Lambda Workflow (defined by .github/workflows/gcf-snapshot.yml) deploys the application on each commit and the API can be accessed at the following URL:

6.9 Microsoft Azure

The subproject starter-azure-function provides a function that can be deployed to Microsoft Azure.

Running the Function Locally

First uncomment the Azure plugin from starter-azure-function/build.grade:

./gradlew clean starter-azure-function:azureFunctionsRun

Continuous Deployment

Micronaut Starter API is continuously deployed to Azure Function as a Serverless Java application.

The Snapshot to Azure Workflow (defined by .github/workflows/azure-function-snapshot.yml) deploys the application on each commit and the API can be accessed at the following URL:

Deploying the Function Yourself

First uncomment the Azure plugin from starter-azure-function/build.grade then run:

./gradlew clean starter-azure-function:azureFunctionsDeploy

7 Community Features

Community Features

Micronaut Launch includes Community Features such as those from Agorapulse, Camunda, and JobRunr.

A feature that adds a Micronaut library which the Micronaut Foundation does not maintain is considered a Community Feature. In the event that Micronaut Foundation assumes responsibility for a Community Feature, it could potentially become an official Micronaut Launch feature instead.