120 lines
3.1 KiB
Markdown
120 lines
3.1 KiB
Markdown
|
---
|
|||
|
title: 快速构建项目
|
|||
|
description: 如何快速构建项目
|
|||
|
published: true
|
|||
|
date: 2021-08-17T13:54:47.580Z
|
|||
|
tags: wg-basic
|
|||
|
editor: markdown
|
|||
|
dateCreated: 2021-08-17T13:54:47.580Z
|
|||
|
---
|
|||
|
|
|||
|
# 创建项目
|
|||
|
|
|||
|
使用IDEA创建SpringBoot项目
|
|||
|
|
|||
|

|
|||
|
|
|||
|
| 名称 | 说明 |
|
|||
|
|--|--|
|
|||
|
| Name | 项目名称,推荐使用英文单词组合创建名字,单词之间用英文减号“-”链接 |
|
|||
|
| Languate | 项目语言,这里默认Java |
|
|||
|
| Type | 依赖管理工具,这里默认Maven |
|
|||
|
| Group | 组ID,应为公司域名倒叙写,如com.cn |
|
|||
|
| Artifact | 项目唯一标识,推荐使用英文单词组合创建名字,单词之间用英文减号“-”链接,默认与项目名称一致 |
|
|||
|
| Package name | 启动类所在包 |
|
|||
|
| Project SDK | 这里选择1.8 |
|
|||
|
| Java | java版本,这里与SDK同步,选择8 |
|
|||
|
| Packaging | 打包方式,默认为Jar |
|
|||
|
|
|||
|
注意:这里SpringBoot的版本在 **2.1.2.RELEASE** 版本之上
|
|||
|
|
|||
|
|
|||
|
# POM依赖
|
|||
|
|
|||
|
properties属性
|
|||
|
|
|||
|
```xml
|
|||
|
<properties>
|
|||
|
<java.version>1.8</java.version>
|
|||
|
<spring-mybatis.version>2.1.4</spring-mybatis.version>
|
|||
|
<mysql.version>8.0.22</mysql.version>
|
|||
|
<druid.version>1.1.9</druid.version>
|
|||
|
</properties>
|
|||
|
```
|
|||
|
|
|||
|
dependencies依赖
|
|||
|
|
|||
|
1. SpringBoot项目必须依赖
|
|||
|
```xml
|
|||
|
<dependencies>
|
|||
|
<dependency>
|
|||
|
<groupId>org.springframework.boot</groupId>
|
|||
|
<artifactId>spring-boot-starter-web</artifactId>
|
|||
|
</dependency>
|
|||
|
<dependency>
|
|||
|
<groupId>org.springframework.boot</groupId>
|
|||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
|||
|
</dependency>
|
|||
|
<dependency>
|
|||
|
<groupId>org.springframework.boot</groupId>
|
|||
|
<artifactId>spring-boot-starter-freemarker</artifactId>
|
|||
|
</dependency>
|
|||
|
<dependency>
|
|||
|
<groupId>mysql</groupId>
|
|||
|
<artifactId>mysql-connector-java</artifactId>
|
|||
|
<version>${mysql.version}</version>
|
|||
|
<scope>runtime</scope>
|
|||
|
</dependency>
|
|||
|
<dependency>
|
|||
|
<groupId>org.springframework.boot</groupId>
|
|||
|
<artifactId>spring-boot-starter-test</artifactId>
|
|||
|
<scope>test</scope>
|
|||
|
</dependency>
|
|||
|
<dependency>
|
|||
|
<groupId>org.mybatis.spring.boot</groupId>
|
|||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
|||
|
<version>${spring-mybatis.version}</version>
|
|||
|
</dependency>
|
|||
|
<dependency>
|
|||
|
<groupId>com.alibaba</groupId>
|
|||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
|||
|
<version>${druid.version}</version>
|
|||
|
</dependency>
|
|||
|
<dependency>
|
|||
|
<groupId>junit</groupId>
|
|||
|
<artifactId>junit</artifactId>
|
|||
|
<scope>test</scope>
|
|||
|
</dependency>
|
|||
|
</dependencies>
|
|||
|
```
|
|||
|
|
|||
|
2. wg-basic基础项目所需依赖
|
|||
|
```xml
|
|||
|
<dependencies>
|
|||
|
<!-- 角色模块,该模块包含权限模块、菜单模块、组织机构模块、用户模块 -->
|
|||
|
<dependency>
|
|||
|
<groupId>ink.wgink</groupId>
|
|||
|
<artifactId>service-role</artifactId>
|
|||
|
<version>1.0-SNAPSHOT</version>
|
|||
|
</dependency>
|
|||
|
<!-- 登录模块,引入该模块后,访问系统需要登录 -->
|
|||
|
<dependency>
|
|||
|
<groupId>ink.wgink</groupId>
|
|||
|
<artifactId>login-base</artifactId>
|
|||
|
<version>1.0-SNAPSHOT</version>
|
|||
|
</dependency>
|
|||
|
</dependencies>
|
|||
|
```
|
|||
|
|
|||
|
# 配置文件
|
|||
|
|
|||
|
在resources目录下,创建application.yml配置
|
|||
|
|
|||
|
```yml
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
# 静态资源
|
|||
|
|
|||
|
|
|||
|
# 启动项目
|