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.
$ mn profile-info service
Profile: service
------------------
The service profile
Provided Commands:
--------------------
create-bean Creates a singleton bean
create-client Creates a client interface
create-controller Creates a controller and associated test
create-job Creates a job with scheduled method
create-test Creates a simple test for the project's testing framework
create-websocket-client Creates a Websocket client
create-websocket-server Creates a Websocket server
help Prints help information for a specific command
Provided Features:
------------------
...
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
profile: service
defaultPackage: example
---
testFramework: spock
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.