当前位置:网站首页>微服务开发环境搭建
微服务开发环境搭建
2022-06-13 01:40:00 【吾爱乐享】
1. 配置maven,使用阿里镜像库
找到maven下载安装目录,找到conf配置文件,修改setting.xml配置文件
- 找到搜索mirror,修改官方的镜像为阿里镜像
<mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>https://maven.aliyun.com/nexus/content/groups/public/</url> </mirror> </mirrors>
- 搜索找到profile,修改jdk版本,让maven使用jdk1.8编译项目
<profiles>
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
- 找到idea设置,maven构建设置,配置maven,让idea使用我们本地的maven

2.idea下载常用的插件,lomok插件和mybatis插件
- lomok插件作用是可以简化java bean的开发
- mybatisX插件作用是可以快速从mapper定位到xml文件
3.新建工程,微服务分布式工程
新建一个总springboot工程集体管理其他模块
4.前端开发工具安装vs code
安装后,需要安装一些插件
- Auto close Tag 自动闭合 HTML/XML 标签
- Auto Rename Tag 自动完成另一侧标签的同步修改
- Chinese 中文界面
- ESLint :es语法检查,语法纠错
- HTML css Support:让 html 标签上写 class 智能提示当前项目所支持的样式
- HTML Snippets:html 快速自动补全
- JavaScript Es6 code snippets :ES6 语法智能提示以及快速输入,除 js 外还支 持.ts,.jsx,.tsx,.html,.vue,省去了配置其支持各种包含 js 代码文件的时间
- Live server : 以内嵌服务器方式打开
- open in browser:浏览器快速打开
- vetur:语法高亮、智能感知、Emmet 等
安装十个插件

5.配置git代码仓库管理
下载git客户端管理工具并安装
在任何位置右键会显示gitgui和gitbash,打开gitbash窗口,对git进行设置,告诉git哪个用户名,邮箱在使用,每次提交的话会显示作者名
git config --global user.name "wuailexiang" //用户名自定义,提交代码时会显示提交者的名称
git config --global user.email "[email protected]" //邮箱需要时gitee注册邮箱
为了避免每次拉取代码或提交代码输入账号密码,设置ssh免密连接,设置好后通过命令 ssh -T [email protected]查看是否成功,会提示是否需要使用这个密钥作为连接,输入yes即可,以后就会使用这个密钥提交拉取
在gitee上新建一个仓库
初始化仓库,选择语言java,添加gitignore模版选择maven,分支模型选择生产/开发模型,开发好后在提交到master分支

#### 6.在idea上创建一个项目
使用刚才新建的git仓库,在file-new- project from version 复制git上新建的仓库地址clone一个项目

新建module,选择springboot 勾选两个微服务必要插件,Spring web 和服务之间需要远程调用的openFeign

所有模块添加成功后,把这个项目作为一个总项目,把微服务其他服务作为一个模块添加进来,复制其他一个服务中的pom.xml到这个总目录底下修改配置文件,删除没有到文件,添加package为pom
<?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>
<groupId>com.atguigu.gulimall</groupId>
<artifactId>gulimall</artifactId>
<version>1.0.0</version>
<name>gulimall</name>
<description>聚合服务</description>
<packaging>pom</packaging>
</projec>
<modules>
<module>gulimall-member</module>
<module>gulimall-order</module>
<module>gulimall-product</module>
<module>gulimall-ware</module>
<module>gulimall-coupon</module>
</modules>
点击maven+号,把总服务添加进来,对总服务进行操作,其他都会更新

修改git提交不需要的文件过滤掉,提交git时就不会带上无用的文件,只保留src代码文件和pom文件,和. gitignore文件
在总项目中修改.gitignore文件,添加需要屏蔽的不用的文件,使用**/匹配任何目录下的某一个不需要提交的文件名
**/mvnw
**/mvnw.cmd
**/.mvn
**/target/
.idea
**/.gitignore
**/gulimall.iml

勾选提交commit提交到本地,然后push到gitee仓库

本文永久更新地址:
边栏推荐
- Thread code learning notes
- MySQL - use field alias after where
- MySQL ---- where后使用字段别名
- Minimum score of one question per day
- 如何利用您的自有数据来实现营销目标?
- Simple operation of MySQL database
- Should the audience choose observation mode or positioning mode?
- Set and array conversion, list, array
- Add default right-click menu
- Temporary objects and compilation optimization
猜你喜欢

The storage structure of a tree can adopt the parent representation, that is, the parent pointer array representation. Try to give the corresponding class definition. Each tree node contains two membe

【斯坦福計網CS144項目】Lab1: StreamReassembler

30: Kakfa simulates JSON data generation and transmission

STM32 3*3矩阵按键(寄存器版本)

Database query user mailbox

Temporary objects and compilation optimization

Startup, connection and stop of MySQL service

Implementation and design of JMeter interface test database assertion for CSDN salary increase technology

Idea installation tutorial

Summary of various installation methods of Lab View
随机推荐
Cmake has no obvious error after compilation, but prompts that pthread cannot be found
[andoid][step pit]cts 11_ Testbootclasspathandsystemserverclasspath at the beginning of R3_ Analysis of nonduplicateclasses fail
Plumber game
[Andoid][踩坑]CTS 11_r3开始出现的testBootClassPathAndSystemServerClasspath_nonDuplicateClasses FAIL问题分析
Three paradigms of database
Traversal of binary tree - first order traversal, middle order traversal, and second order traversal
Workspace for ROS
ES6 deconstruction assignment
MySQL download and installation
[pytorch FAQ] numpy:dll load failed while importing_ multiarray_ Umath: the specified module could not be found.
numpy多维数组转置transpose
[MathType] use MathType to output latex style formula
Jeux de plombiers
[Stanford Jiwang cs144 project] lab1: streamreassembler
How does Apple add QQ email?
What is Google plus large text ads? How to use it?
如何利用您的自有数据来实现营销目标?
Golang context (context summary)
Stack stack LIFO
Startup, connection and stop of MySQL service
