【笔记】通过STS创建SpringBoot项目
发表于|更新于
|阅读量:
前言
基于SpringToolSuite4创建SpringBoot项目
准备工作
STS中Maven的配置
Spring Tool Suite 4
->Preferences
->Maven
->Installations
->Add
![](/images/20200825170603/01.webp)
![](/images/20200825170603/02.webp)
![](/images/20200825170603/03.webp)
Maven
->User Settings
->修改配置->应用
![](/images/20200825170603/04.webp)
通过官方的Starter创建项目
File
->New
->Spring Starter Project
![](/images/20200825170603/05.webp)
![](/images/20200825170603/06.webp)
![](/images/20200825170603/07.webp)
通过阿里云的Starter创建项目
File
->New
->Spring Starter Project
![](/images/20200825170603/05.webp)
- 配置项目参数,将
Server URL
改为阿里云的Starter->Next
![](/images/20200825170603/08.webp)
- 如果版本显示错误,可以手动调整版本,在配置版本处不管版本号,选择
Next
![](/images/20200825170603/09.webp)
![](/images/20200825170603/10.webp)
通过官网打包导入项目
SNAPSHOT
:快照版本
M2
:增加重要功能的版本,不是正式版
![](/images/20200825170603/11.webp)
![](/images/20200825170603/12.webp)
![](/images/20200825170603/13.webp)
通过普通Maven项目创建项目
![](/images/20200825170603/14.webp)
![](/images/20200825170603/15.webp)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.3.RELEASE</version> <relativePath/> </parent> <groupId>com.company</groupId> <artifactId>CGB-SPRINGBOOT-04</artifactId> <version>0.0.1-SNAPSHOT</version> <name>CGB-SPRINGBOOT-01</name> <description>Demo project for Spring Boot</description>
<properties> <java.version>1.8</java.version> </properties>
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency>
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> </dependencies>
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
</project>
|
- 右键项目->
Maven
->Update Project
![](/images/20200825170603/16.webp)
- 选中
Force Update of Snapshots/Releases
强制更新->OK
![](/images/20200825170603/17.webp)
1 2 3 4 5 6 7 8
| @SpringBootApplication public class CgbSpringboot04Application {
public static void main(String[] args) { SpringApplication.run(CgbSpringboot04Application.class, args); } }
|
通过在其他机器的新项目复制
完成