Maven搭建springboot项目
本文是基于Windows 10系统环境,使用Maven搭建springboot项目
一、springboot项目搭建
(1) 新建目录
在某个可用目录下,新建一个文件夹,本文新建目录为 D:\demo\zs200
(2) 创建maven父工程zs200a-parent
填写项目maven坐标
填写项目名称和路径
(2) maven父工程zs200a-parent的pom文件
<&#63;xml version="1.0" encoding="UTF-8"&#63;>4.0.0 com.chaoyue.zs200a zs200a-parent 1.0-SNAPSHOT pom org.springframework.boot spring-boot-starter-parent 2.0.6.RELEASE UTF-8 UTF-8 1.8 Finchley.SR2 org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import
(3) 创建maven子工程zs200a-user
(4) maven子工程zs200a-user的pom文件
<&#63;xml version="1.0" encoding="UTF-8"&#63;>zs200a-parent com.chaoyue.zs200a 1.0-SNAPSHOT 4.0.0 com.chaoyue.zs200a zs200a-user 1.0-SNAPSHOT pom
(5) 创建maven子工程zs200a-user-interface
(6) maven子工程zs200a-user-interface的pom文件
<&#63;xml version="1.0" encoding="UTF-8"&#63;>zs200a-user com.chaoyue.zs200a 1.0-SNAPSHOT 4.0.0 com.chaoyue.zs200a zs200a-user-interface 1.0-SNAPSHOT org.projectlombok lombok
(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
(9) maven子工程zs200a-user-service的pom文件
<&#63;xml version="1.0" encoding="UTF-8"&#63;>zs200a-user com.chaoyue.zs200a 1.0-SNAPSHOT 4.0.0 com.chaoyue.zs200a zs200a-user-service 1.0-SNAPSHOT org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.boot spring-boot-starter-web com.chaoyue.zs200a zs200a-user-interface 1.0-SNAPSHOT org.springframework.boot spring-boot-maven-plugin
(10) zs200a-user-service工程中新建一个UserServiceApplication类
package com.chaoyue.zs200a.user; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @SpringBootApplication @EnableDiscoveryClient public class UserServiceApplication { public static void main(String[] args) { SpringApplication.run(UserServiceApplication.class, args); } }
(11) maven工程整体打包并部署到本地仓库
到此这篇关于Maven搭建springboot项目的方法步骤的文章就介绍到这了,更多相关Maven搭建springboot内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!