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