目錄
一、克隆
方法一
方法二
二、初始化項(xiàng)目
構(gòu)建基本框架
自動(dòng)生成代碼?
一、克隆
方法一
由于github速度較慢,這里我們使用gitee。我們?cè)趃itee上面創(chuàng)建一個(gè)倉庫,然后我們可以通過ideal直接克隆下來,倉庫設(shè)置如下
接著使用ideal將項(xiàng)目克隆下來,首先復(fù)制項(xiàng)目的地址
打開ideal,選擇文件-新建(New)-project from version control
將復(fù)制的地址粘貼到url,選擇克隆即可
方法二
安裝配置git
2、配置 git,進(jìn)入 git bash
# 配置用戶名
git config --global user.name "username"
//(名字)
# 配置郵箱
git config --global user.email "username@email.com"
//(注冊(cè)賬號(hào)時(shí)用的郵箱)

4.克隆gitee項(xiàng)目
在git bash中輸入指令克隆到桌面
git clone 倉庫地址
然后使用ideal導(dǎo)入即可。
二、初始化項(xiàng)目
構(gòu)建基本框架
首先創(chuàng)建一個(gè)父項(xiàng)目作為聚合模塊,把所有的子項(xiàng)目聚合在一起??梢允紫仍趇deal中創(chuàng)建springboot項(xiàng)目(通過spring initiaizer),然后將其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>0.0.1-SNAPSHOT</version>
<name>gulimall</name>
<description>聚合服務(wù)</description>
<packaging>pom</packaging>
</project>
接著在該項(xiàng)目下創(chuàng)建maven模塊,即子模塊。首先創(chuàng)建common模塊,作為其他模塊公共的依賴、bean、工具類等。
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>gulimall</artifactId>
<groupId>com.atguigu.gulimall</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>gulimall-common</artifactId>
<description>每一個(gè)微服務(wù)公共的依賴,bean,工具類等</description>
<dependencies>
<!-- mybatis-plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>
<!-- lombok簡(jiǎn)化開發(fā)-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.12</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!--導(dǎo)入mysql的驅(qū)動(dòng)-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
</dependencies>
</project>
接著創(chuàng)建其他業(yè)務(wù)模塊,然后在依賴中加入common模塊即可
<dependency>
<groupId>com.atguigu.gulimall</groupId>
<artifactId>gulimall-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
自動(dòng)生成代碼?
模塊創(chuàng)建完成后可以使用mybatis自動(dòng)生成代碼,也可以使用人人開源的renren-generator代碼生成器。這里使用第二種。在gitee上搜人人開源,找到renren-generator將項(xiàng)目克隆下來,并加入聚合項(xiàng)目,修改application.yml中的數(shù)據(jù)庫連接,還有properties中的一些屬性(mainpath,package,moduleName,author,email,tablePrefix表前綴)
以生成gulimall-ware的代碼為例,數(shù)據(jù)庫為gulimall-wms
數(shù)據(jù)庫如下,表前綴都為wms:
?generator.properties如下:
項(xiàng)目啟動(dòng)后,生成代碼并將其中的main目錄整個(gè)復(fù)制到gulimall-ware中?
對(duì)于每個(gè)數(shù)據(jù)庫都要修改配置文件然后重新啟動(dòng)renren-generator,每個(gè)模塊生成完畢后可以進(jìn)行測(cè)試,比如對(duì)controller中查詢列表的接口進(jìn)行測(cè)試文章來源:http://www.zghlxwxcb.cn/news/detail-744635.html
所有模塊生成代碼完成后配置端口號(hào)以免產(chǎn)生沖突。項(xiàng)目初始化結(jié)束文章來源地址http://www.zghlxwxcb.cn/news/detail-744635.html
到了這里,關(guān)于gitee上創(chuàng)建新倉庫如何clone到本地,并初始化項(xiàng)目的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!