Micronaut Starter

Generates Micronaut applications

Version: 4.5.0

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

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

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

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

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

-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.5.0")
<dependency>
    <groupId>io.micronaut.starter</groupId>
    <artifactId>micronaut-starter-core</artifactId>
    <version>4.5.0</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.5.0-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.5.0-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.5.0.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.5.0-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.