본문 바로가기
프로그래밍/Spring

스프링 부트 CLI에서 Initializr사용

by Mr-후 2019. 1. 8.
반응형

아직 능숙하거나 숙련되지는 못했지만 만약 이 기술을 가지고 밥을 먹고 살아야 한다면 익숙해져야겠지. 그리고 이런 툴에도 익숙해져야할지 모른다. 

물론 주어진 툴을 이용해서 해도 되지만, 커맨드 라인에서 처리하는 이런 것들도 알아두면 유용할 것 같다. 

spring boot의 CLI을 이용한 Initializr를 사용하는 간단한 help 명령이다. 

2019/01/08 - [Programming/Java & Spring] - 스프링 CLI 설치 (Mac OS X, Homebrew)


younghuui-MacBook-Pro:workspace younghumin$ spring help init

spring init - Initialize a new project using Spring Initializr (start.spring.io)


usage: spring init [options] [location]


Option                       Description                                       

------                       -----------                                       

-a, --artifactId <String>    Project coordinates; infer archive name (for      

                               example 'test')                                 

-b, --boot-version <String>  Spring Boot version (for example '1.2.0.RELEASE') 

--build <String>             Build system to use (for example 'maven' or       

                               'gradle') (default: maven)                      

-d, --dependencies <String>  Comma-separated list of dependency identifiers to 

                               include in the generated project                

--description <String>       Project description                               

-f, --force                  Force overwrite of existing files                 

--format <String>            Format of the generated content (for example      

                               'build' for a build file, 'project' for a       

                               project archive) (default: project)             

-g, --groupId <String>       Project coordinates (for example 'org.test')      

-j, --java-version <String>  Language level (for example '1.8')                

-l, --language <String>      Programming language  (for example 'java')        

--list                       List the capabilities of the service. Use it to   

                               discover the dependencies and the types that are

                               available                                       

-n, --name <String>          Project name; infer application name              

-p, --packaging <String>     Project packaging (for example 'jar')             

--package-name <String>      Package name                                      

-t, --type <String>          Project type. Not normally needed if you use --   

                               build and/or --format. Check the capabilities of

                               the service (--list) for more details           

--target <String>            URL of the service to use (default: https://start.

                               spring.io)                                      

-v, --version <String>       Project version (for example '0.0.1-SNAPSHOT')    

-x, --extract                Extract the project archive. Inferred if a        

                               location is specified without an extension      


examples:


    To list all the capabilities of the service:

        $ spring init --list


    To creates a default project:

        $ spring init


    To create a web my-app.zip:

        $ spring init -d=web my-app.zip


    To create a web/data-jpa gradle project unpacked:

        $ spring init -d=web,jpa --build=gradle my-dir



younghuui-MacBook-Pro:workspace younghumin$ spring init -a myfirstSpringBoot -dweb,jpa,security

Using service at https://start.spring.io

Content saved to 'myfirstSpringBoot.zip'


그냥 참고용 리소스로 올려둠. 




p>

$ spring init -dweb,jpa,security 


데이터 영속성으로 JPA를 사용하고 스프링 시큐리티로 보안을 적용하는 웹 애플리케이션을 개발한다고 한 경우, 이런 초기 의존성은 --dependencies나 -d 옵션으로 설정한다. 


$ spring init -dweb,jpa,security --build gradle 


기본적으로 메이븐(pom.xml)을 사용하는데 --build 매개변수로 빌드 타입을 그레이들로 지정한 경우 

-d와 의존성 사이에는 공백이 없어야 한다는 점에 주의할 것! 


$ spring init -dweb,jpa,security --build gradle -p war myapp 


기본적으로 메이븐과 그레이들의 빌드 명세는 실행 가능한 JAR 파일을 생성한다. WAR 파일로 생성하려면 --packaging이나 -p 매개변수를 사용한다. 

마지막 매개변수는 프로젝트 압축 파일을 myapp 디렉터리에 풀기를 원한다는 의미. 생성된 프로젝트 압축 파일을 현재 디렉터리에 풀고 싶다면 --extract나 -x 매개변수를 사용한다. 


$ spring init -dweb,jpa,security --build gradle -p jar -x 


Spring Initializr서비스가 지원하는 기능을 모두 확인하려면 --list 매개변수를 지정하여 init 명령을 실행한다. 

별생각없이 명령어를 쳐보니 어마무시한 정보가 나타났다. 놀라움 ^^ 


younghuui-MacBook-Pro:workspace younghumin$ spring init --list

  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

:: Service capabilities ::  https://start.spring.io


Supported dependencies

+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------+

| Id                                   | Description                                                                                                                                    | Required version              |

+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------+

| activemq                             | Java Message Service API via Apache ActiveMQ                                                                                                   |                               |

| actuator                             | Production ready features to help you monitor and manage your application                                                                      |                               |

| actuator-docs                        | API documentation for the Actuator endpoints                                                                                                   | >=1.5.0.RELEASE and <2.0.0.M1 |

| amqp                                 | Advanced Message Queuing Protocol via spring-rabbit                                                                                            |                               |

| aop                                  | Create your own Aspects using Spring AOP and AspectJ                                                                                           |                               |

| artemis                              | Java Message Service API via Apache Artemis                                                                                                    |                               |

| azure-active-directory               | Spring Security integration with Azure Active Directory for authentication                                                                     | >=1.5.4.RELEASE               |

| azure-keyvault-secrets               | Spring value annotation integration with Azure Key Vault Secrets                                                                               | >=1.5.4.RELEASE               |

| azure-storage                        | Azure Storage service integration                                                                                                              | >=1.5.4.RELEASE               |

| azure-support                        | Auto-configuration for Azure Services (service bus, storage, active directory, cosmos DB, key vault and more)                                  | >=1.5.4.RELEASE               |

| batch                                | Spring Batch support                                                                                                                           |                               |

| cache                                | Spring's Cache abstraction                                                                                                                     |                               |

| camel                                | Integration using Apache Camel                                                                                                                 | >=1.5.0.RELEASE               |

| cloud-aws                            | AWS native services from spring-cloud-aws                                                                                                      |                               |

| cloud-aws-jdbc                       | Relational databases on AWS with RDS and spring-cloud-aws-jdbc                                                                                 |                               |

| cloud-aws-messaging                  | Messaging on AWS with SQS and spring-cloud-aws-messaging                                                                                       |                               |

| cloud-bus                            | A simple control bus using Spring Cloud Stream (requires a binder, e.g. Kafka or RabbitMQ)                                                     |                               |

| cloud-cloudfoundry-discovery         | Service discovery with Cloud Foundry                                                                                                           |                               |

| cloud-config-client                  | spring-cloud-config Client                                                                                                                     |                               |

| cloud-config-server                  | Central management for configuration via a git or svn backend                                                                                  |                               |

| cloud-connectors                     | Simplifies connecting to services in cloud platforms, including spring-cloud-connector and spring-cloud-cloudfoundry-connector                 |                               |

| cloud-contract-stub-runner           | Stub Runner for HTTP/Messaging based communication. Allows creating WireMock stubs from RestDocs tests                                         |                               |

| cloud-contract-verifier              | Test dependencies required for autogenerated tests                                                                                             |                               |

| cloud-eureka                         | Service discovery using spring-cloud-netflix and Eureka                                                                                        |                               |

| cloud-eureka-server                  | spring-cloud-netflix Eureka Server                                                                                                             |                               |

| cloud-feign                          | Declarative REST clients with spring-cloud-netflix Feign                                                                                       |                               |

| cloud-function                       | Functions as Spring Beans                                                                                                                      | >=2.0.2.RELEASE               |

| cloud-gateway                        | Intelligent and programmable routing with the reactive Spring Cloud Gateway                                                                    | >=2.0.0.M5                    |

| cloud-gcp                            | Support for Google Cloud Platform services                                                                                                     | >=2.0.0.RELEASE               |

| cloud-gcp-pubsub                     | Publish to and subcribe from Google Cloud Pub/Sub topics                                                                                       | >=2.0.0.RELEASE               |

| cloud-gcp-storage                    | Access Google Cloud Storage objects                                                                                                            | >=2.0.0.RELEASE               |

| cloud-hystrix                        | Circuit breaker with spring-cloud-netflix Hystrix                                                                                              |                               |

| cloud-hystrix-dashboard              | Circuit breaker dashboard with spring-cloud-netflix Hystrix                                                                                    |                               |

| cloud-oauth2                         | OAuth2 and distributed application patterns with spring-cloud-security                                                                         |                               |

| cloud-ribbon                         | Client side load balancing with spring-cloud-netflix and Ribbon                                                                                |                               |

| cloud-security                       | Secure load balancing and routing with spring-cloud-security                                                                                   |                               |

| cloud-starter                        | spring-cloud-context (e.g. Bootstrap context and @RefreshScope)                                                                                |                               |

| cloud-starter-consul-config          | Configuration management with Hashicorp Consul                                                                                                 |                               |

| cloud-starter-consul-discovery       | Service discovery with Hashicorp Consul                                                                                                        |                               |

| cloud-starter-sleuth                 | Distributed tracing via logs with spring-cloud-sleuth                                                                                          |                               |

| cloud-starter-vault-config           | Configuration management with HashiCorp Vault                                                                                                  | >=1.5.3.RELEASE               |

| cloud-starter-zipkin                 | Distributed tracing with an existing Zipkin installation and spring-cloud-sleuth-zipkin. Alternatively, consider Sleuth Stream.                |                               |

| cloud-starter-zookeeper-config       | Configuration management with Zookeeper and spring-cloud-zookeeper-config                                                                      |                               |

| cloud-starter-zookeeper-discovery    | Service discovery with Zookeeper and spring-cloud-zookeeper-discovery                                                                          |                               |

| cloud-stream                         | Messaging microservices with Spring Cloud Stream (requires a binder, e.g. Kafka or RabbitMQ)                                                   |                               |

| cloud-task                           | Task result tracking and integration with Spring Batch                                                                                         |                               |

| cloud-turbine                        | Circuit breaker metric aggregation using spring-cloud-netflix with Turbine and server-sent events                                              |                               |

| cloud-turbine-stream                 | Circuit breaker metric aggregation using spring-cloud-netflix with Turbine and Spring Cloud Stream (requires a binder, e.g. Kafka or RabbitMQ) | >=1.3.0.RELEASE               |

| cloud-zuul                           | Intelligent and programmable routing with spring-cloud-netflix Zuul                                                                            |                               |

| codecentric-spring-boot-admin-client | Register your application with a Spring Boot Admin instance                                                                                    | >=1.5.9.RELEASE               |

| codecentric-spring-boot-admin-server | An admin interface for Spring Boot applications                                                                                                | >=1.5.9.RELEASE               |

| configuration-processor              | Generate metadata for your custom configuration keys                                                                                           | >=1.2.0.RELEASE               |

| cxf-jaxrs                            | RESTful Web Services framework with support of JAX-RS                                                                                          | >=1.5.0.RELEASE and <2.1.0.M1 |

| data-cassandra                       | Cassandra NoSQL Database, including spring-data-cassandra                                                                                      |                               |

| data-cassandra-reactive              | Cassandra NoSQL Database, including spring-data-cassandra and the reactive driver                                                              | >=2.0.0.M1                    |

| data-couchbase                       | Couchbase NoSQL database, including spring-data-couchbase                                                                                      |                               |

| data-couchbase-reactive              | Couchbase NoSQL database, including spring-data-couchbase and the reactive driver                                                              | >=2.0.0.M7                    |

| data-elasticsearch                   | Elasticsearch search and analytics engine including spring-data-elasticsearch                                                                  |                               |

| data-gemfire                         | GemFire distributed data store including spring-data-gemfire                                                                                   | >=1.5.0.RELEASE and <2.0.0.M1 |

| data-jpa                             | Java Persistence API including spring-data-jpa, spring-orm and Hibernate                                                                       |                               |

| data-ldap                            | LDAP support, including spring-data-ldap                                                                                                       | >=1.5.0.RELEASE               |

| data-mongodb                         | MongoDB NoSQL Database, including spring-data-mongodb                                                                                          |                               |

| data-mongodb-reactive                | MongoDB NoSQL Database, including spring-data-mongodb and the reactive driver                                                                  | >=2.0.0.M1                    |

| data-neo4j                           | Neo4j NoSQL graph database, including spring-data-neo4j                                                                                        |                               |

| data-redis                           | Redis key-value data store, including spring-data-redis                                                                                        |                               |

| data-redis-reactive                  | Redis key-value data store, including spring-data-redis                                                                                        | >=2.0.0.M7                    |

| data-rest                            | Exposing Spring Data repositories over REST via spring-data-rest-webmvc                                                                        |                               |

| data-rest-hal                        | Browsing Spring Data REST repositories in your browser                                                                                         |                               |

| data-solr                            | Apache Solr search platform, including spring-data-solr                                                                                        |                               |

| derby                                | Apache Derby database (with embedded support)                                                                                                  |                               |

| devtools                             | Spring Boot Development Tools                                                                                                                  | >=1.3.0.RELEASE               |

| flapdoodle-mongo                     | Embedded MongoDB for testing                                                                                                                   |                               |

| flyway                               | Flyway Database Migrations library                                                                                                             |                               |

| freemarker                           | FreeMarker templating engine                                                                                                                   |                               |

| groovy-templates                     | Groovy templating engine                                                                                                                       |                               |

| h2                                   | H2 database (with embedded support)                                                                                                            |                               |

| hateoas                              | HATEOAS-based RESTful services                                                                                                                 |                               |

| hsql                                 | HSQLDB database (with embedded support)                                                                                                        |                               |

| integration                          | Common spring-integration modules                                                                                                              |                               |

| jdbc                                 | JDBC databases                                                                                                                                 |                               |

| jersey                               | RESTful Web Services framework with support of JAX-RS                                                                                          |                               |

| jooq                                 | Persistence support using Java Object Oriented Querying                                                                                        |                               |

| kafka                                | Kafka messaging support using Spring Kafka                                                                                                     | >=1.5.0.RELEASE               |

| kafka-streams                        | Support for building stream processing applications with Apache Kafka Streams                                                                  | >=2.0.0.RELEASE               |

| keycloak                             | Keycloak integration, an open source Identity and Access Management solution.                                                                  | >=1.5.3.RELEASE and <2.1.0.M1 |

| liquibase                            | Liquibase Database Migrations library                                                                                                          |                               |

| lombok                               | Java annotation library which helps to reduce boilerplate code and code faster                                                                 |                               |

| mail                                 | Send email using Java Mail and Spring Framework's JavaMailSender                                                                               |                               |

| mobile                               | Simplify the development of mobile web applications with spring-mobile                                                                         | >=1.5.0.RELEASE and <2.0.0.M1 |

| mustache                             | Mustache templating engine                                                                                                                     |                               |

| mybatis                              | Persistence support using MyBatis                                                                                                              |                               |

| mysql                                | MySQL JDBC driver                                                                                                                              |                               |

| open-service-broker                  | Create service brokers that conform to the Open Service Broker API specification                                                               | >=2.0.0.RELEASE               |

| postgresql                           | PostgreSQL JDBC driver                                                                                                                         |                               |

| quartz                               | Schedule jobs using Quartz                                                                                                                     | >=2.0.0.M2                    |

| ratpack                              | Spring Boot integration for the Ratpack framework                                                                                              | >=1.5.0.RELEASE and <2.0.0.M1 |

| reactive-cloud-stream                | Reactive messaging microservices with Spring Cloud Stream (requires a binder, e.g. Kafka or RabbitMQ)                                          | >=2.0.0.RC2                   |

| restdocs                             | Document RESTful services by combining hand-written and auto-generated documentation                                                           |                               |

| retry                                | Provide declarative retry support via spring-retry                                                                                             |                               |

| scs-circuit-breaker                  | Hystrix circuit breaker on Pivotal Cloud Foundry                                                                                               |                               |

| scs-config-client                    | Config client on Pivotal Cloud Foundry                                                                                                         |                               |

| scs-service-registry                 | Eureka service discovery on Pivotal Cloud Foundry                                                                                              |                               |

| security                             | Secure your application via spring-security                                                                                                    |                               |

| session                              | API and implementations for managing a user’s session information                                                                              |                               |

| spring-shell                         | Build shell-based clients                                                                                                                      |                               |

| sqlserver                            | Microsoft SQL Server JDBC driver                                                                                                               |                               |

| statemachine                         | Build applications using state machine concepts                                                                                                | >=2.0.0.RC1                   |

| thymeleaf                            | Thymeleaf templating engine                                                                                                                    |                               |

| vaadin                               | Vaadin java web application framework                                                                                                          |                               |

| validation                           | JSR-303 validation infrastructure (already included with web)                                                                                  |                               |

| web                                  | Full-stack web development with Tomcat and Spring MVC                                                                                          |                               |

| web-services                         | Contract-first SOAP service development with Spring Web Services                                                                               |                               |

| webflux                              | Reactive web development with Netty and Spring WebFlux                                                                                         | >=2.0.0.M1                    |

| websocket                            | Websocket development with SockJS and STOMP                                                                                                    |                               |

+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------+



Project types (* denotes the default)

+-----------------+-----------------------------------------+-----------------------------+

| Id              | Description                             | Tags                        |

+-----------------+-----------------------------------------+-----------------------------+

| gradle-build    | Generate a Gradle build file            | build:gradle,format:build   |

| gradle-project  | Generate a Gradle based project archive | build:gradle,format:project |

| maven-build     | Generate a Maven pom.xml                | build:maven,format:build    |

| maven-project * | Generate a Maven based project archive  | build:maven,format:project  |

+-----------------+-----------------------------------------+-----------------------------+



Parameters

+-------------+------------------------------------------+------------------------------+

| Id          | Description                              | Default value                |

+-------------+------------------------------------------+------------------------------+

| artifactId  | project coordinates (infer archive name) | demo                         |

| bootVersion | spring boot version                      | 2.1.1.RELEASE                |

| description | project description                      | Demo project for Spring Boot |

| groupId     | project coordinates                      | com.example                  |

| javaVersion | language level                           | 1.8                          |

| language    | programming language                     | java                         |

| name        | project name (infer application name)    | demo                         |

| packageName | root package                             | com.example.demo             |

| packaging   | project packaging                        | jar                          |

| type        | project type                             | maven-project                |

| version     | project version                          | 0.0.1-SNAPSHOT               |

+-------------+------------------------------------------+------------------------------+




반응형