1. init project
1) 도움말을 보는 것은 spring help [command]이다.
ex) init manual
$ spring help init
spring init - Initialize a new project using Spring Initializr (start.spring.io)
usage: spring init [options] [location]
Option Description
------ -----------
-a, --artifactId Project coordinates; infer archive
name (for example 'test')
-b, --boot-version Spring Boot version (for example
'1.2.0.RELEASE')
--build Build system to use (for example
'maven' or 'gradle') (default: maven)
-d, --dependencies Comma-separated list of dependency
identifiers to include in the
generated project
--description Project description
-f, --force Force overwrite of existing files
--format Format of the generated content (for
example 'build' for a build file,
'project' for a project archive)
(default: project)
-g, --groupId Project coordinates (for example 'org.
test')
-j, --java-version Language level (for example '1.8')
-l, --language Programming language (for example
'java')
-n, --name Project name; infer application name
-p, --packaging Project packaging (for example 'jar')
--package-name Package name
-t, --type Project type. Not normally needed if
you use --build and/or --format.
Check the capabilities of the
service (--list) for more details
--target URL of the service to use (default:
https://start.spring.io)
-v, --version 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
$ spring init --build=gradle [project name]
2) Create init project
$ spring init --build=gradle mydir
Using service at https://start.spring.io
Project extracted to '/home/hklee/test/test2/mydir'
$ ls
mydir
$ tree
.
└── mydir
├── build.gradle
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── src
├── main
│ ├── java
│ │ └── com
│ │ └── example
│ │ └── DemoApplication.java
│ └── resources
│ └── application.properties
└── test
└── java
└── com
└── example
└── DemoApplicationTests.java
13 directories, 8 files
3. Run
따로 gradle을 이용해서 jar을 만들고 실행할 필요가 없다.
$spring run mydir
Reference : http://docs.spring.io/spring-boot/docs/current/reference/html/cli-using-the-cli.html
'소프트웨어 > Spring Boot' 카테고리의 다른 글
[Spring Boot] maven install and build. (0) | 2016.07.07 |
---|---|
[Spring Boot] spring boot java.lang.RuntimeException: java.lang.reflect.InvocationTargetException (0) | 2016.07.06 |
[Spring Boot] Create and Play project (0) | 2016.07.06 |
[Spring Boot] Intro (0) | 2016.07.04 |
[sdkman] install, error solution (fail to download) (0) | 2016.07.04 |