Can you alter a Micronaut App features from the command line?

Viewed 1724

I created a new Micronaut from the CLI and tinkered around a bit then realized that I could add features from the cli but it seems to only be an option when calling create-app.

Is there a way to add features from the command line after the app has been created?

2 Answers

Unfortunately no, the CLI is limited to project-generation commands (create-app, create-federation) and code-generation (commands like create-controller and create-client). It does not have the ability to modify existing projects at this time.

Micronaut CLI has a new command: feature-diff that produces the diff of an original project with an original project with additional features specified as a parameter.

Example of a command with reactor feature:

mn feature-diff --features=reactor

Which generates something like this: Micronaut CLI feature-diff results

You can store the differences in a file and apply it to your project:

mn feature-diff --features=reactor > reactor-features.diff
patch -i reactor-features.diff

Note Micronout CLI provides -f, --force option to override existing files, however, that option didn't work for me, hence patch option as a workaround.

Related