当前位置:网站首页>Establishment of microservice development environment

Establishment of microservice development environment

2022-06-13 01:44:00 I love to enjoy

1. To configure maven, Use Alibaba image library

find maven Download installation directory , find conf The configuration file , modify setting.xml The configuration file

  • Find search mirror, Change the official image to Alibaba image

<mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>https://maven.aliyun.com/nexus/content/groups/public/</url> </mirror> </mirrors>

  • Search for profile, modify jdk edition , Give Way maven Use jdk1.8 Compile the project
<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>
  • find idea Set up ,maven Build settings , To configure maven, Give Way idea Use our local maven

image-20220608222718003

2.idea Download commonly used plug-ins ,lomok Plug ins and mybatis plug-in unit

  • lomok The role of plug-ins is to simplify java bean Development of
  • mybatisX The function of the plug-in is to quickly start from mapper Locate the xml file

3. New project , Microservice distributed engineering

Create a new general springboot Other modules of project collective management

4. Front end development tool installation vs code

After installation , You need to install some plug-ins

  • Auto close Tag Auto close HTML/XML label
  • Auto Rename Tag Automatically complete the synchronous modification of the other side label
  • Chinese Chinese interface
  • ESLint :es Syntax check , Grammatical error correction
  • HTML css Support: Give Way html Write on labels class Smart tip the styles supported by the current project
  • HTML Snippets:html Fast automatic completion
  • JavaScript Es6 code snippets :ES6 Grammar intelligent prompt and fast input , except js External reparative branch a .ts,.jsx,.tsx,.html,.vue, Omit to configure it to support a variety of include js Time of code file
  • Live server : Open as an embedded server
  • open in browser: The browser opens quickly
  • vetur: Syntax highlighting 、 intellisense 、Emmet etc.

Install ten plug-ins

image-20220608230651141

5. To configure git Code warehouse management

  • download git Client management tools and install

  • Right click anywhere to display gitgui and gitbash, open gitbash window , Yes git Set it up , tell git Which user name , The mailbox is in use , Each submission will display the author name

  • git config --global user.name "wuailexiang" // User name customization , The name of the submitter is displayed when you submit the code

  • git config --global user.email "[email protected]" // Mailbox when needed gitee Sign up for email

  • To avoid entering the account password every time you pull or submit the code , Set up ssh No secret connection , After setting, use the command ssh -T [email protected] Check for success , You will be prompted whether you need to use this key as a connection , Input yes that will do , This key will be used later to submit and pull

  • stay gitee Build a new warehouse

  • Initialize the repository , Choice language java, add to gitignore Template selection maven, Branch model selection production / Development model , After development, submit to master Branch

  • image-20220608232632206

#### 6. stay idea Create a project on

Use the newly created git Warehouse , stay file-new- project from version Copy git New warehouse address on clone A project

image-20220608233615019

newly build module, choice springboot Check the two necessary microservice plug-ins ,Spring web And services that need to be called remotely openFeign

image-20220608234323305

After all modules are added successfully , Take this project as a general project , Add microservices and other services as a module , Copy... From another service pom.xml Modify the configuration file under the general directory , Delete files that have not been added , add to package by 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> Aggregation services </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>

Click on maven+ Number , Add total services , Operate on the total service , Everything else will be updated

image-20220609000454542

modify git Submit unwanted documents and filter them out , Submit git You won't bring useless files with you , Only keep src Code files and pom file , and . gitignore file

Modify in master project .gitignore file , Add unused files that need to be shielded , Use **/ Match a file name in any directory that does not need to be submitted

**/mvnw
**/mvnw.cmd
**/.mvn
**/target/
.idea
**/.gitignore
**/gulimall.iml

image-20220609001932951

Check submit commit Submit to local , then push To gitee Warehouse

image-20220609002253275


This article permanently updates the address :

https://www.fenxiangbe.com/p/ Build a microservice development environment .html

原网站

版权声明
本文为[I love to enjoy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/164/202206130140245588.html