17.1 Creating a Project

Creating a project is the primary usage of the CLI. There are two primary commands for creating new projects: create-app and create-function. Both of these commands will generate a project based upon an associated profile (which can be overridden), and will set the micronaut.application.name configuration property in src/main/resources/application.yml.

In addition, there are specialty commands for creating a “federation” of multiple Micronaut services (create-federation) and for creating new profiles for the CLI (create-profile).

Table 1. Micronaut CLI Project Creation Commands
CommandDescriptionOptionsExample

create-app

Creates a basic Micronaut application, using the service profile by default.

  • -p, —profile

  • -l, —lang

  • -f, —features

  • -b, —build

  • -i, —inplace

  1. mn create-app my-project features
  2. mongo-reactive,security-jwt build maven

create-cli-app

Creates a command-line Micronaut application, using the cli profile by default.

  • -p, —profile

  • -f, —features

  • -l, —lang

  • -t, —test

  • -b, —build

  • -i, —inplace

  1. mn create-cli-app my-project features
  2. http-client,jdbc-hikari build maven
  3. lang kotlin test kotlintest

create-function

Creates a Micronaut serverless function, using the function-aws profile by default.

  • -p, —provider

  • -l, —lang

  • -t, —test

  • -f, —features

  • -b, —build

  • -i, —inplace

  1. mn create-function my-lambda-function
  2. lang groovy test spock

create-federation

Creates a federation of Micronaut services with shared profile/features.

  • -s, —services

  • -p, —profile

  • -f, —features

  • -b, —build

  • -i, —inplace

  1. mn create-federation my-federation
  2. services users,inventory,billing

create-profile

Creates a Micronaut profile

  • -p, —profile

  • -f, —features

  • -i, —inplace

  1. mn create-profile security-service
  2. profile service features security-jwt