Micronaut Starter

Generates Micronaut applications

Version: 4.7.2

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