Micronaut Launch

Generates Micronaut applications

Version:

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 a 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 Installation

2.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 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>

2.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>

2.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>

2.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>

2.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>

2.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 be able to run the Micronaut CLI.

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

3 Release History

2.0.0.M3

  • Initial Milestone Release

4 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-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-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-dbcp, jdbc-hikari, data-r2dbc, spring, data-hibernate-reactive, springloaded, cassandra, oracle, logback, tracing-opentelemetry-gcp, kubernetes-reactor-client, micrometer-jmx, nats, micrometer-appoptics, security-jwt, kubernetes-informer, slf4j-simple, netflix-archaius, gcp-cloud-trace, multi-tenancy, arm, testcontainers, micronaut-aot, rss, cache-caffeine, tracing-opentelemetry-xray, crac, mysql, netflix-hystrix, micrometer-dynatrace, log4j2, security, oci-devops-build-ci, tracing-opentelemetry-zipkin, dynamodb, agorapulse-gru-http, aws-secrets-manager, jooq, mongo-reactive, oracle-function, security-ldap, http-client, data-mongodb, dekorate-kubernetes, email-javamail, object-storage-oracle-cloud, netty-server, postgres, azure-key-vault, graalvm, jms-sqs, dekorate-openshift, hibernate-reactive-jpa, github-workflow-ci, assertj, rxjava2, data-jdbc, views-velocity, kubernetes, micrometer-influx, rxjava1, gradle-enterprise, spring-data-jpa, neo4j-bolt, jmx, github-workflow-graal-docker-registry, jib, micrometer-azure-monitor, email-template, cache-coherence, jackson-xml, dekorate-halkyon, cache-ehcache, knative, coherence, jasync-sql, undertow-server, data-jpa, mqttv3, vertx-mysql-client, aws-v2-sdk, data-mongodb-reactive, hamcrest, sql-jdbi, elasticsearch, micrometer-atlas, jms-oracle-aq, hibernate-validator, openapi, sqlserver, agorapulse-micronaut-worker, jms-activemq-classic, discovery-consul, tomcat-server, github-workflow-oracle-cloud-functions, jetty-server, aws-lambda-custom-runtime, google-cloud-workflow-ci, dekorate-prometheus, micrometer-ganglia, jax-rs, kafka, microstream-cache, gcp-pubsub, discovery-kubernetes, config-kubernetes, tracing-opentelemetry-exporter-logging, views-thymeleaf, views-soy, coherence-data, tracing-zipkin, object-storage-azure, camunda-platform7, micrometer-datadog, object-storage-aws, rabbitmq, agorapulse-micronaut-permissions, mongo-sync, amazon-api-gateway-http, spring-web, micrometer-statsd, views-handlebars, kotlin-extension-functions, github-workflow-google-cloud-run-graalvm, config-consul, swagger-ui, cache-hazelcast, micrometer-humio, camunda-external-worker, micrometer-annotation, amazon-cognito, multi-tenancy-gorm, aws-lambda, micrometer-new-relic, azure-function, azure-cosmos-db, micrometer-kairos, micrometer-stackdriver, test-resources, email-amazon-ses, micrometer-graphite, agorapulse-micronaut-console, mariadb, tracing-jaeger, serialization-jsonp, microstream, coherence-grpc-client, oracle-cloud-sdk, graphql, problem-json, email-postmark, serialization-bson, micrometer-elastic, dekorate-jaeger, gitlab-workflow-ci, tracing-opentelemetry-exporter-otlp, discovery-eureka, google-cloud-function, mqtt, redis-lettuce, oracle-cloud-atp, coherence-distributed-configuration, reactor, rss-itunes-podcast, jackson-databind, h2, micrometer-signalfx, github-workflow-azure-container-instance-graalvm, coherence-session, flyway, hibernate-gorm, hibernate-jpa, rxjava3, kafka-streams, micrometer-prometheus, awaitility, tracing-opentelemetry-jaeger, spring-boot, kubernetes-rxjava2-client, micrometer-wavefront, kubernetes-client, junit-params, aws-codebuild-workflow-ci, github-workflow-google-cloud-run, mongo-gorm, asciidoctor, acme, management, jms-core, x86, netflix-ribbon, views-rocker, email-sendgrid, dekorate-knative, http-session, views-jte, dekorate-servicecatalog, github-workflow-oracle-cloud-functions-graalvm, aws-alexa, gcp-secrets-manager, liquibase, email-mailjet, views-freemarker, camunda-zeebe, micrometer-cloudwatch, vertx-pg-client, localstack, neo4j-gorm, oracle-cloud-vault, mockito, cache-infinispan, aws-parameter-store, serialization-jackson, jrebel, microstream-rest, spring-data-jdbc, lombok, object-storage-gcp, github-workflow-docker-registry, r2dbc, views-pebble, github-workflow-azure-container-instance, jms-activemq-artemis, openrewrite, amazon-api-gateway, micronaut-test-rest-assured, micrometer-oracle-cloud, security-oauth2, security-session, aws-cdk, ktor, shade, 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

-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-dbcp, jdbc-hikari, data-r2dbc, spring, data-hibernate-reactive, springloaded, cassandra, oracle, logback, kubernetes-reactor-client, nats, security-jwt, kubernetes-informer, slf4j-simple, gcp-cloud-trace, multi-tenancy, arm, testcontainers, cache-caffeine, crac, mysql, netflix-hystrix, log4j2, security, oci-devops-build-ci, dynamodb, jooq, mongo-reactive, security-ldap, http-client, data-mongodb, email-javamail, object-storage-oracle-cloud, postgres, graalvm, jms-sqs, hibernate-reactive-jpa, github-workflow-ci, assertj, rxjava2, data-jdbc, rxjava1, gradle-enterprise, spring-data-jpa, neo4j-bolt, github-workflow-graal-docker-registry, jib, email-template, cache-coherence, jackson-xml, cache-ehcache, coherence, jasync-sql, data-jpa, mqttv3, vertx-mysql-client, aws-v2-sdk, data-mongodb-reactive, hamcrest, sql-jdbi, elasticsearch, jms-oracle-aq, hibernate-validator, sqlserver, jms-activemq-classic, github-workflow-oracle-cloud-functions, google-cloud-workflow-ci, kafka, microstream-cache, gcp-pubsub, coherence-data, object-storage-azure, object-storage-aws, rabbitmq, agorapulse-micronaut-permissions, mongo-sync, kotlin-extension-functions, github-workflow-google-cloud-run-graalvm, cache-hazelcast, multi-tenancy-gorm, azure-cosmos-db, test-resources, email-amazon-ses, mariadb, serialization-jsonp, microstream, coherence-grpc-client, oracle-cloud-sdk, graphql, problem-json, email-postmark, serialization-bson, gitlab-workflow-ci, mqtt, redis-lettuce, oracle-cloud-atp, reactor, jackson-databind, h2, github-workflow-azure-container-instance-graalvm, coherence-session, flyway, hibernate-gorm, hibernate-jpa, rxjava3, kafka-streams, awaitility, spring-boot, kubernetes-rxjava2-client, kubernetes-client, junit-params, aws-codebuild-workflow-ci, github-workflow-google-cloud-run, mongo-gorm, asciidoctor, jms-core, x86, netflix-ribbon, email-sendgrid, http-session, github-workflow-oracle-cloud-functions-graalvm, liquibase, email-mailjet, vertx-pg-client, localstack, neo4j-gorm, mockito, cache-infinispan, serialization-jackson, jrebel, microstream-rest, spring-data-jdbc, lombok, object-storage-gcp, github-workflow-docker-registry, r2dbc, github-workflow-azure-container-instance, jms-activemq-artemis, openrewrite, micronaut-test-rest-assured, security-oauth2, security-session, shade, 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

-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-dbcp, jdbc-hikari, data-r2dbc, spring, data-hibernate-reactive, springloaded, cassandra, oracle, logback, tracing-opentelemetry-gcp, kubernetes-reactor-client, nats, security-jwt, kubernetes-informer, slf4j-simple, netflix-archaius, gcp-cloud-trace, multi-tenancy, arm, testcontainers, cache-caffeine, tracing-opentelemetry-xray, mysql, netflix-hystrix, log4j2, security, oci-devops-build-ci, tracing-opentelemetry-zipkin, dynamodb, aws-secrets-manager, jooq, mongo-reactive, oracle-function, security-ldap, http-client, data-mongodb, email-javamail, aws-lambda-s3-event-notification, object-storage-oracle-cloud, postgres, azure-key-vault, graalvm, jms-sqs, aws-lambda-function-url, hibernate-reactive-jpa, aws-lambda-scheduled-event, github-workflow-ci, assertj, rxjava2, data-jdbc, rxjava1, gradle-enterprise, spring-data-jpa, neo4j-bolt, github-workflow-graal-docker-registry, jib, email-template, cache-coherence, jackson-xml, cache-ehcache, coherence, jasync-sql, data-jpa, mqttv3, vertx-mysql-client, aws-v2-sdk, data-mongodb-reactive, hamcrest, sql-jdbi, elasticsearch, jms-oracle-aq, hibernate-validator, sqlserver, jms-activemq-classic, discovery-consul, github-workflow-oracle-cloud-functions, aws-lambda-custom-runtime, google-cloud-workflow-ci, kafka, microstream-cache, gcp-pubsub, discovery-kubernetes, tracing-opentelemetry-exporter-logging, coherence-data, tracing-zipkin, object-storage-azure, object-storage-aws, rabbitmq, agorapulse-micronaut-permissions, mongo-sync, amazon-api-gateway-http, kotlin-extension-functions, github-workflow-google-cloud-run-graalvm, config-consul, cache-hazelcast, multi-tenancy-gorm, aws-lambda, azure-function, azure-cosmos-db, test-resources, email-amazon-ses, mariadb, tracing-jaeger, serialization-jsonp, microstream, coherence-grpc-client, oracle-cloud-sdk, graphql, problem-json, email-postmark, serialization-bson, gitlab-workflow-ci, tracing-opentelemetry-exporter-otlp, discovery-eureka, google-cloud-function, mqtt, redis-lettuce, oracle-cloud-atp, coherence-distributed-configuration, reactor, jackson-databind, h2, github-workflow-azure-container-instance-graalvm, coherence-session, flyway, hibernate-gorm, hibernate-jpa, rxjava3, kafka-streams, awaitility, tracing-opentelemetry-jaeger, spring-boot, kubernetes-rxjava2-client, kubernetes-client, junit-params, aws-codebuild-workflow-ci, github-workflow-google-cloud-run, mongo-gorm, asciidoctor, jms-core, x86, netflix-ribbon, email-sendgrid, http-session, github-workflow-oracle-cloud-functions-graalvm, aws-alexa, gcp-secrets-manager, liquibase, email-mailjet, vertx-pg-client, localstack, neo4j-gorm, oracle-cloud-vault, mockito, cache-infinispan, aws-parameter-store, serialization-jackson, jrebel, microstream-rest, spring-data-jdbc, lombok, object-storage-gcp, github-workflow-docker-registry, r2dbc, github-workflow-azure-container-instance, jms-activemq-artemis, openrewrite, amazon-api-gateway, micronaut-test-rest-assured, security-oauth2, security-session, aws-cdk, shade, 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

-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-dbcp, jdbc-hikari, data-r2dbc, spring, data-hibernate-reactive, springloaded, cassandra, oracle, logback, tracing-opentelemetry-gcp, kubernetes-reactor-client, nats, security-jwt, kubernetes-informer, slf4j-simple, netflix-archaius, gcp-cloud-trace, multi-tenancy, arm, testcontainers, cache-caffeine, tracing-opentelemetry-xray, mysql, netflix-hystrix, log4j2, security, oci-devops-build-ci, tracing-opentelemetry-zipkin, dynamodb, aws-secrets-manager, jooq, mongo-reactive, security-ldap, http-client, data-mongodb, dekorate-kubernetes, email-javamail, object-storage-oracle-cloud, postgres, azure-key-vault, graalvm, jms-sqs, dekorate-openshift, hibernate-reactive-jpa, github-workflow-ci, assertj, rxjava2, data-jdbc, kubernetes, rxjava1, gradle-enterprise, spring-data-jpa, neo4j-bolt, github-workflow-graal-docker-registry, jib, email-template, cache-coherence, jackson-xml, dekorate-halkyon, cache-ehcache, knative, coherence, jasync-sql, data-jpa, mqttv3, vertx-mysql-client, aws-v2-sdk, data-mongodb-reactive, hamcrest, sql-jdbi, elasticsearch, jms-oracle-aq, hibernate-validator, sqlserver, jms-activemq-classic, discovery-consul, github-workflow-oracle-cloud-functions, google-cloud-workflow-ci, dekorate-prometheus, kafka, microstream-cache, gcp-pubsub, discovery-kubernetes, config-kubernetes, tracing-opentelemetry-exporter-logging, coherence-data, tracing-zipkin, object-storage-azure, object-storage-aws, rabbitmq, agorapulse-micronaut-permissions, mongo-sync, kotlin-extension-functions, github-workflow-google-cloud-run-graalvm, config-consul, cache-hazelcast, multi-tenancy-gorm, azure-cosmos-db, test-resources, email-amazon-ses, mariadb, tracing-jaeger, serialization-jsonp, microstream, coherence-grpc-client, oracle-cloud-sdk, graphql, problem-json, email-postmark, serialization-bson, dekorate-jaeger, gitlab-workflow-ci, tracing-opentelemetry-exporter-otlp, discovery-eureka, mqtt, redis-lettuce, oracle-cloud-atp, coherence-distributed-configuration, reactor, jackson-databind, h2, github-workflow-azure-container-instance-graalvm, coherence-session, flyway, hibernate-gorm, hibernate-jpa, rxjava3, kafka-streams, awaitility, tracing-opentelemetry-jaeger, spring-boot, kubernetes-rxjava2-client, kubernetes-client, junit-params, aws-codebuild-workflow-ci, github-workflow-google-cloud-run, mongo-gorm, asciidoctor, jms-core, x86, netflix-ribbon, email-sendgrid, dekorate-knative, http-session, dekorate-servicecatalog, github-workflow-oracle-cloud-functions-graalvm, gcp-secrets-manager, liquibase, email-mailjet, vertx-pg-client, localstack, neo4j-gorm, oracle-cloud-vault, mockito, cache-infinispan, aws-parameter-store, serialization-jackson, jrebel, microstream-rest, spring-data-jdbc, lombok, object-storage-gcp, github-workflow-docker-registry, r2dbc, github-workflow-azure-container-instance, jms-activemq-artemis, openrewrite, micronaut-test-rest-assured, security-oauth2, security-session, shade, 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

-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-dbcp, jdbc-hikari, data-r2dbc, spring, data-hibernate-reactive, springloaded, cassandra, oracle, logback, tracing-opentelemetry-gcp, kubernetes-reactor-client, nats, security-jwt, kubernetes-informer, slf4j-simple, netflix-archaius, gcp-cloud-trace, multi-tenancy, arm, testcontainers, cache-caffeine, tracing-opentelemetry-xray, mysql, netflix-hystrix, log4j2, security, oci-devops-build-ci, tracing-opentelemetry-zipkin, dynamodb, aws-secrets-manager, jooq, mongo-reactive, security-ldap, http-client, data-mongodb, email-javamail, object-storage-oracle-cloud, postgres, azure-key-vault, graalvm, jms-sqs, hibernate-reactive-jpa, github-workflow-ci, assertj, rxjava2, data-jdbc, rxjava1, gradle-enterprise, spring-data-jpa, neo4j-bolt, github-workflow-graal-docker-registry, jib, email-template, cache-coherence, jackson-xml, cache-ehcache, coherence, jasync-sql, data-jpa, mqttv3, vertx-mysql-client, aws-v2-sdk, data-mongodb-reactive, hamcrest, sql-jdbi, elasticsearch, jms-oracle-aq, hibernate-validator, sqlserver, jms-activemq-classic, discovery-consul, github-workflow-oracle-cloud-functions, google-cloud-workflow-ci, kafka, microstream-cache, gcp-pubsub, discovery-kubernetes, config-kubernetes, tracing-opentelemetry-exporter-logging, coherence-data, tracing-zipkin, object-storage-azure, object-storage-aws, rabbitmq, agorapulse-micronaut-permissions, mongo-sync, kotlin-extension-functions, github-workflow-google-cloud-run-graalvm, config-consul, cache-hazelcast, multi-tenancy-gorm, azure-cosmos-db, test-resources, email-amazon-ses, mariadb, tracing-jaeger, serialization-jsonp, microstream, coherence-grpc-client, oracle-cloud-sdk, graphql, problem-json, email-postmark, serialization-bson, gitlab-workflow-ci, tracing-opentelemetry-exporter-otlp, discovery-eureka, mqtt, redis-lettuce, oracle-cloud-atp, coherence-distributed-configuration, reactor, jackson-databind, h2, github-workflow-azure-container-instance-graalvm, coherence-session, flyway, hibernate-gorm, hibernate-jpa, rxjava3, kafka-streams, awaitility, tracing-opentelemetry-jaeger, spring-boot, kubernetes-rxjava2-client, kubernetes-client, junit-params, aws-codebuild-workflow-ci, github-workflow-google-cloud-run, mongo-gorm, asciidoctor, jms-core, x86, netflix-ribbon, email-sendgrid, http-session, github-workflow-oracle-cloud-functions-graalvm, gcp-secrets-manager, liquibase, email-mailjet, vertx-pg-client, localstack, neo4j-gorm, oracle-cloud-vault, mockito, cache-infinispan, aws-parameter-store, serialization-jackson, jrebel, microstream-rest, spring-data-jdbc, lombok, object-storage-gcp, github-workflow-docker-registry, r2dbc, github-workflow-azure-container-instance, jms-activemq-artemis, openrewrite, micronaut-test-rest-assured, security-oauth2, security-session, shade, 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

-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.

5 Micronaut Launch

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

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

5.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-3.8.4-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-3.8.4-all.jar

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

./mn

5.2 OpenAPI Specification

This project uses Micronaut’s 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-starter-1.0.yml

5.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-3.8.4-all.jar

5.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.

5.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).

5.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 setup 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.

5.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 java11 --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

5.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:

5.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