17 Micronaut CLI

The Micronaut CLI is the recommended way to create new Micronaut projects. The CLI includes commands for generating specific categories of projects, allowing you to choose between build tools, test frameworks, and even pick the language you wish to use in your application. The CLI also provides commands for generating artifacts such as controllers, client interfaces, and serverless functions.

We have a website that can be used to generate projects instead of the CLI. Check out Micronaut Launch to get started!

When Micronaut is installed on your computer, you can call the CLI with the mn command.

  1. $ mn create-app my-app

A Micronaut CLI project can be identified by the micronaut-cli.yml file, which will be included at the root of the project (if it was generated via the CLI). This file will include the project’s profile, default package, and other variables. The project’s default package is evaluated based on the project name.

  1. $ mn create-app my-demo-app

Will result in the default package being my.demo.app.

You can supply your own default package when creating the application by prefixing the application name with the package:

  1. $ mn create-app example.my-demo-app

Will result in the default package being example.