[JAVA] Micronaut CLI Profiles and Features

Micronaut CLI? Micronaut CLI is a CLI tool provided by Micronaut (manma).

Micronaut CLI

The Micronaut CLI is the recommended way to create new Micronaut projects.

When creating a new Micronaut project, it is recommended to use this Micronaut CLI.

Features?

By the way, when using CLI with Micronaut, you may specify --features as follows.

For example, if you want to create a project for Groovy.

$ mn create-app hello-world-groovy --build maven --features=groovy

What are the --features that can be specified here? So I looked it up.

environment

This environment is here.

$ mn -V
| Micronaut Version: 1.0.4
| JVM Version: 1.8.0_191

Profiles and Features

First, how to check.

Features

Execute the profile-info command of the Micronaut CLI with Profile specified.

There are two Profiles, service and function.

For service Profile.

$ 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-websocket-client  Creates a Websocket client
  create-websocket-server  Creates a Websocket server
  help                  Prints help information for a specific command

| Provided Features:
--------------------
  annotation-api        Adds Java annotation API
  cassandra             Adds support for Cassandra in the application
  config-consul         Adds support for Distributed Configuration with Consul (https://www.consul.io)
  discovery-consul      Adds support for Service Discovery with Consul (https://www.consul.io)
  discovery-eureka      Adds support for Service Discovery with Eureka
  graal-native-image    Allows Building a Native Image
  groovy                Creates a Groovy application
  hibernate-gorm        Adds support for GORM persistence framework
  hibernate-jpa         Adds support for Hibernate/JPA
  http-client           Adds support for creating HTTP clients
  http-server           Adds support for running a Netty server
  java                  Creates a Java application
  jdbc-dbcp             Configures SQL DataSource instances using Commons DBCP
  jdbc-hikari           Configures SQL DataSource instances using Hikari Connection Pool
  jdbc-tomcat           Configures SQL DataSource instances using Tomcat Connection Pool
  jib                   Adds support for Jib builds
  jrebel                Adds support for class reloading with JRebel (requires separate JRebel installation)
  junit                 Adds support for the JUnit testing framework
  kafka                 Adds support for Kafka
  kafka-streams         Adds support for Kafka Streams
  kotlin                Creates a Kotlin application
  management            Adds support for management endpoints
  micrometer            Adds support for Micrometer metrics
  micrometer-atlas      Adds support for Micrometer metrics (w/ Atlas reporter)
  micrometer-graphite   Adds support for Micrometer metrics (w/ Graphite reporter)
  micrometer-prometheus  Adds support for Micrometer metrics (w/ Prometheus reporter)
  micrometer-statsd     Adds support for Micrometer metrics (w/ Statsd reporter)
  mongo-gorm            Configures GORM for MongoDB for Groovy applications
  mongo-reactive        Adds support for the Mongo Reactive Streams Driver
  neo4j-bolt            Adds support for the Neo4j Bolt Driver
  neo4j-gorm            Configures GORM for Neo4j for Groovy applications
  netflix-archaius      Adds support for Netflix Archaius in the application
  netflix-hystrix       Adds support for Netflix Hystrix in the application
  netflix-ribbon        Adds support for Netflix Ribbon in the application
  picocli               Adds support for command line parsing (http://picocli.info)
  postgres-reactive     Adds support for the Reactive Postgres driver in the application
  rabbitmq              Adds support for RabbitMQ in the application
  redis-lettuce         Configures the Lettuce driver for Redis
  security-jwt          Adds support for JWT (JSON Web Token) based Authentication
  security-session      Adds support for Session based Authentication
  spek                  Adds support for the Spek testing framework
  spock                 Adds support for the Spock testing framework
  springloaded          Adds support for class reloading with Spring-Loaded
  swagger-groovy        Configures Swagger (OpenAPI) Integration for Groovy
  swagger-java          Configures Swagger (OpenAPI) Integration for Java
  swagger-kotlin        Configures Swagger (OpenAPI) Integration for Kotlin
  tracing-jaeger        Adds support for distributed tracing with Jaeger (https://www.jaegertracing.io)
  tracing-zipkin        Adds support for distributed tracing with Zipkin (https://zipkin.io)

For function Profile.

$ mn profile-info function
| Profile: function
--------------------
The function profile

| Provided Commands:
--------------------
  create-bean  Creates a singleton bean
  create-job   Creates a job with scheduled method
  help         Prints help information for a specific command

| Provided Features:
--------------------
  annotation-api        Adds Java annotation API
  cassandra             Adds support for Cassandra in the application
  config-consul         Adds support for Distributed Configuration with Consul (https://www.consul.io)
  discovery-consul      Adds support for Service Discovery with Consul (https://www.consul.io)
  discovery-eureka      Adds support for Service Discovery with Eureka
  graal-native-image    Allows Building a Native Image
  groovy                Creates a Groovy application
  hibernate-gorm        Adds support for GORM persistence framework
  hibernate-jpa         Adds support for Hibernate/JPA
  http-client           Adds support for creating HTTP clients
  http-server           Adds support for running a Netty server
  java                  Creates a Java application
  jdbc-dbcp             Configures SQL DataSource instances using Commons DBCP
  jdbc-hikari           Configures SQL DataSource instances using Hikari Connection Pool
  jdbc-tomcat           Configures SQL DataSource instances using Tomcat Connection Pool
  jib                   Adds support for Jib builds
  jrebel                Adds support for class reloading with JRebel (requires separate JRebel installation)
  junit                 Adds support for the JUnit testing framework
  kafka                 Adds support for Kafka
  kafka-streams         Adds support for Kafka Streams
  kotlin                Creates a Kotlin application
  management            Adds support for management endpoints
  micrometer            Adds support for Micrometer metrics
  micrometer-atlas      Adds support for Micrometer metrics (w/ Atlas reporter)
  micrometer-graphite   Adds support for Micrometer metrics (w/ Graphite reporter)
  micrometer-prometheus  Adds support for Micrometer metrics (w/ Prometheus reporter)
  micrometer-statsd     Adds support for Micrometer metrics (w/ Statsd reporter)
  mongo-gorm            Configures GORM for MongoDB for Groovy applications
  mongo-reactive        Adds support for the Mongo Reactive Streams Driver
  neo4j-bolt            Adds support for the Neo4j Bolt Driver
  neo4j-gorm            Configures GORM for Neo4j for Groovy applications
  netflix-archaius      Adds support for Netflix Archaius in the application
  netflix-hystrix       Adds support for Netflix Hystrix in the application
  netflix-ribbon        Adds support for Netflix Ribbon in the application
  openfaas              Adds support for OpenFaaS
  picocli               Adds support for command line parsing (http://picocli.info)
  postgres-reactive     Adds support for the Reactive Postgres driver in the application
  rabbitmq              Adds support for RabbitMQ in the application
  redis-lettuce         Configures the Lettuce driver for Redis
  security-jwt          Adds support for JWT (JSON Web Token) based Authentication
  security-session      Adds support for Session based Authentication
  spek                  Adds support for the Spek testing framework
  spock                 Adds support for the Spock testing framework
  springloaded          Adds support for class reloading with Spring-Loaded
  swagger-groovy        Configures Swagger (OpenAPI) Integration for Groovy
  swagger-java          Configures Swagger (OpenAPI) Integration for Java
  swagger-kotlin        Configures Swagger (OpenAPI) Integration for Kotlin
  tracing-jaeger        Adds support for distributed tracing with Jaeger (https://www.jaegertracing.io)
  tracing-zipkin        Adds support for distributed tracing with Zipkin (https://zipkin.io)

Like below

| Provided Features:

In that place, the available Features are lined up.

When I look at Pat, I feel like I'm thinking "Isn't it the same?", But when I look at it, only the function Profile contains the following one.

  openfaas              Adds support for OpenFaaS

So, Profile is a project template, which is a collection of commands and structures for creating skeletons such as default settings and build dependencies.

Profiles

The default Profile is service.

The command was definitely different.

## service Profile
$ 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-websocket-client  Creates a Websocket client
  create-websocket-server  Creates a Websocket server
  help                  Prints help information for a specific command


## function Profile
$ mn profile-info function
| Profile: function
--------------------
The function profile

| Provided Commands:
--------------------
  create-bean  Creates a singleton bean
  create-job   Creates a job with scheduled method
  help         Prints help information for a specific command

For this Profile, GitHub has its own Organization.

micronaut-profiles-versions

At the moment, service, function, and federation are lined up, so it will increase over time.

Now you know what you can specify for --features.

Also, it looks good to see here as well.

Micronaut Profiles

I mean, there seem to be more Profiles that you can actually specify.

$ mn list-profiles
| Available Profiles
--------------------
  cli           The cli profile
  federation    The federation profile
  function-aws  The function profile for AWS Lambda
  kafka         The Kafka messaging profile
  profile       A profile for creating new Micronaut profiles
  service       The service profile

Help and Info

Should I look around here for the --features that is applied to each Profile by default?

https://github.com/micronaut-projects/micronaut-profiles/blob/v1.0.3/service/profile.yml

https://github.com/micronaut-projects/micronaut-profiles/blob/v1.0.3/function-aws/profile.yml

Recommended Posts

Micronaut CLI Profiles and Features
Java version 8 and later features
Java 9 new features and sample code
CRUD features and MVC in Rails