Micronaut CLI?
Micronaut CLIというのは、Micronautが提供するCLIツールのことです(まんま)。
The Micronaut CLI is the recommended way to create new Micronaut projects.
新しいMicronautプロジェクトを作る際には、このMicronaut CLIを利用して作成することが推奨されます。
Features?
ところで、MicronautでCLIを使う時に以下のように--features
の指定をすることがあります。
たとえば、プロジェクトをGroovy向けのものとして作成したい場合。
$ mn create-app hello-world-groovy --build maven --features=groovy
ここで指定できる--features
って、なにがあるんだろう?ということで調べてみました。
環境
今回の環境は、こちらです。
$ mn -V
| Micronaut Version: 1.0.4
| JVM Version: 1.8.0_191
ProfilesとFeatures
先に、確認方法を。
Micronaut CLIのprofile-info
コマンドに、Profileを指定して実行します。
Profileには、service
とfunction
の2つがあります。
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)
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)
以下のような
| Provided Features:
というところに、利用できるFeaturesがずらっと並びます。
パット見て「一緒じゃないか?」と思うような気がしますが、よーーーーく見るとfunction
Profileだけ、次のひとつが混じっています。
openfaas Adds support for OpenFaaS
で、Profileというのはプロジェクトのテンプレートのことで、デフォルトの設定や、ビルドの依存関係などのスケルトンを作成するための構造と、コマンドの集まりです。
デフォルトのProfileは、service
です。
コマンドは、明確に違いましたね。
## 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
このProfileですが、GitHubに専用のOrganizationがあります。
現時点で、service
、function
、そしてfederation
が並んでいるので、そのうち増えたりするんでしょうね。
これで、--features
になにが指定できるかわかりますね。
あと、ここも見ると良さそう。
っていうか、実際に指定できるProfileは、もっとたくさんあるらしい。
$ 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
各Profileにデフォルトで適用される--features
とかは、このあたりを見たらいいのでしょうかね?