Maven搭建springboot项⽬的⽅法步骤Maven搭建springboot项⽬
本⽂是基于Windows 10系统环境,使⽤Maven搭建springboot项⽬
Windows 10
apache-maven-3.6.0
IntelliJ IDEA 2018.3.4 x64
⼀、springboot项⽬搭建
(1) 新建⽬录
在某个可⽤⽬录下,新建⼀个⽂件夹,本⽂新建⽬录为 D:\demo\zs200
(2) 创建maven⽗⼯程zs200a-parent
填写项⽬maven坐标
填写项⽬名称和路径
springcloud和springboot(2) maven⽗⼯程zs200a-parent的pom⽂件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="/POM/4.0.0"
xmlns:xsi="/2001/XMLSchema-instance"
xsi:schemaLocation="/POM/4.0.0 /xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
<groupId>com.chaoyue.zs200a</groupId>
<artifactId>zs200a-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
&porting.outputEncoding>UTF-8</porting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.SR2</spring-cloud.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- springCloud -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
(3) 创建maven⼦⼯程zs200a-user
(4) maven⼦⼯程zs200a-user的pom⽂件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="/POM/4.0.0"
xmlns:xsi="/2001/XMLSchema-instance"
xsi:schemaLocation="/POM/4.0.0 /xsd/maven-4.0.0.xsd"> <parent>
<artifactId>zs200a-parent</artifactId>
<groupId>com.chaoyue.zs200a</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.chaoyue.zs200a</groupId>
<artifactId>zs200a-user</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
</project>
(5) 创建maven⼦⼯程zs200a-user-interface
(6) maven⼦⼯程zs200a-user-interface的pom⽂件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="/POM/4.0.0"
xmlns:xsi="/2001/XMLSchema-instance"
xsi:schemaLocation="/POM/4.0.0 /xsd/maven-4.0.0.xsd"> <parent>
<artifactId>zs200a-user</artifactId>
<groupId>com.chaoyue.zs200a</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.chaoyue.zs200a</groupId>
<artifactId>zs200a-user-interface</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>
(7) zs200a-user-interface⼯程中新建⼀个User类
package com.chaoyue.zs200a.user.pojo;
import lombok.Data;
import java.util.Date;
@Data
public class User {
private Long id;
private String username;
private String password;
private String phone;
private Date created;
private String salt;
}
(8) 创建maven⼦⼯程zs200a-user-service
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论