17.3 Commands

You can view a full list of available commands using the help flag, for example:

  1. $ mn -h
  2. Usage: mn [-hvVx] [COMMAND]
  3. Micronaut CLI command line interface for generating projects and services.
  4. Application generation commands are: (1)
  5. * create-app NAME
  6. * create-cli-app NAME
  7. * create-function-app NAME
  8. * create-grpc-app NAME
  9. * create-messaging-app NAME
  10. Options:
  11. -h, --help Show this help message and exit.
  12. -v, --verbose Create verbose output.
  13. -V, --version Print version information and exit.
  14. -x, --stacktrace Show full stack trace when exceptions occur.
  15. Commands: (2)
  16. create-app Creates an application
  17. create-cli-app Creates a CLI application
  18. create-function-app Creates a Cloud Function
  19. create-grpc-app Creates a gRPC application
  20. create-messaging-app Creates a messaging application
  21. create-job Creates a job with scheduled method
  22. create-bean Creates a singleton bean
  23. create-websocket-client Creates a Websocket client
  24. create-client Creates a client interface
  25. create-controller Creates a controller and associated test
  26. feature-diff Produces the diff of an original project with an original project with
  27. additional features.
  28. create-websocket-server Creates a Websocket server
  29. create-test Creates a simple test for the project's testing framework
1Here you can see the project generation commands lists
2All commands available in the current directory are listed here
3Note: the things listed after the project creation commands (always available) depend on the current directory context

All the code-generation commands honor the values written in micronaut-cli.yml. For example, assume the following micronaut-cli.yml file.

micronaut-cli.yml

  1. defaultPackage: example
  2. ---
  3. testFramework: spock
  4. sourceLanguage: java

With the above settings, the create-bean command (by default) generates a Java class with an associated Spock test, in the example package. Commands accept arguments and these defaults can be overridden on a per-command basis.