17.4 Commands

Profiles can include commands for generating common code artifacts. Not all commands are supported by all profiles; the available commands for a given profile can be viewed using the profile-info command.

  1. $ mn profile-info service
  2. Profile: service
  3. ------------------
  4. The service profile
  5. Provided Commands:
  6. --------------------
  7. create-bean Creates a singleton bean
  8. create-client Creates a client interface
  9. create-controller Creates a controller and associated test
  10. create-job Creates a job with scheduled method
  11. create-test Creates a simple test for the project's testing framework
  12. create-websocket-client Creates a Websocket client
  13. create-websocket-server Creates a Websocket server
  14. help Prints help information for a specific command
  15. Provided Features:
  16. ------------------
  17. ...

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

micronaut-cli.yml

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

With the above settings, the create-controller command will (by default) generate Java controllers with an associated Spock test, under the example package. Commands accept arguments and these defaults can be overriden on a per-command basis.