← 返回命令列表

Linux command

mn 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Create a new application

mn create-app [com.example.myapp]

Create with specific features

mn create-app [com.example.myapp] --features [postgres,hibernate-jpa]

Create a function

mn create-function [com.example.myfunction]

Create a CLI application

mn create-cli-app [com.example.mycli]

Generate a controller

mn create-controller [User]

Generate a service bean

mn create-bean [UserService]

List available features

mn feature-diff --features

Start interactive mode

mn

说明

mn is the Micronaut CLI for scaffolding applications and generating code. Micronaut is a JVM framework for building cloud-native microservices. create-app generates a project with build files, application class, and configuration. Features add dependencies and configuration automatically. Micronaut uses compile-time dependency injection—no reflection at runtime. This enables fast startup and low memory, especially with GraalVM native images. Code generators (create-controller, create-bean, etc.) add classes following Micronaut conventions. Generated code includes annotations for injection, HTTP routing, and testing. Interactive mode provides tab completion for commands and features. Use feature-diff to see what a feature adds to the project.

参数

--features _list_
Comma-separated feature list.
--build _tool_
Build tool: gradle (default), gradle-kotlin, maven.
--lang _language_
Language: java (default), kotlin, groovy.
--jdk _version_
Target JDK version.
--test _framework_
Test framework: junit, spock, kotest.
--inplace
Create in current directory.
-i, --interactive
Interactive mode.

FAQ

What is the mn command used for?

mn is the Micronaut CLI for scaffolding applications and generating code. Micronaut is a JVM framework for building cloud-native microservices. create-app generates a project with build files, application class, and configuration. Features add dependencies and configuration automatically. Micronaut uses compile-time dependency injection—no reflection at runtime. This enables fast startup and low memory, especially with GraalVM native images. Code generators (create-controller, create-bean, etc.) add classes following Micronaut conventions. Generated code includes annotations for injection, HTTP routing, and testing. Interactive mode provides tab completion for commands and features. Use feature-diff to see what a feature adds to the project.

How do I run a basic mn example?

Run `mn create-app [com.example.myapp]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --features _list_ do in mn?

Comma-separated feature list.