Springbootcli 简明教程
Spring Boot CLI - Creating Project
Spring Boot CLI 可用于使用 init 命令创建以 maven 为默认构建工具的新项目。Maven 将使用 https://start.spring.io 服务。在以下示例中,我们将使用 thymeleaf 创建 web 应用程序。转到 E:\Test 文件夹,并键入以下命令:
Spring Boot CLI can be used to create a new project with maven as default build tool using init command. Maven will use https://start.spring.io service. In the following example, we will create a web application using thymeleaf. Go to E:\Test folder and type the following command −
E:/Test> spring init --dependencies = web,thymeleaf MavenApplication.zip
上述命令将生成以下输出 −
The above command will generate the following output −
Using service at https://start.spring.io
Content saved to MavenApplication.zip
Create Gradle project
我们也可以通过将 --build 设置为 gradle 来创建一个基于 Gradle 的项目。为了更好地理解这一点,请考虑以下给出的示例。转到 E:\Test 文件夹,并键入以下命令:
We can create a Gradle based project as well by setting --build as gradle. To understand this in a better way, consider the example given below. Go to E:\Test folder and type the following command −
E:/Test> spring init --build = gradle
--java-version = 1.8 --dependencies = web,thymeleaf
--packaging = war GradleApplication.zip
上述命令将生成以下输出 −
The above command will generate the following output −
Using service at https://start.spring.io
Content saved to GradleApplication.zip