序言

继上一篇 一套管理系统基础模版

详细梳理一下安装流程,功能说明,开发规范等。

  • 后端项目结构?
  • 如何从零搭建环境开发?
  • 如何打包部署?
  • 接入开发及规范
  • 项目地址
  • 小结

后端项目结构

shop-server 依赖以下项目

https://github.com/cuteJ/ot-server-parent (统一版本插件管理)

https://github.com/cuteJ/ot-server-commons (公共基础类)

https://github.com/cuteJ/ot-boot-starter (自定义Spring boot starter)

https://github.com/cuteJ/ot-mybatis-generator (定制生成器)

所依赖的项目安装包位置:https://maven.pkg.github.com/cuteJ/ot-server-parent

依赖继承关系如下:

依赖关系

如何从零搭建环境开发

这一节为零基础搭建,经验开发人员可直接跳过!!!!

安装环境

  • 下载对应平台JDK1.8 Download

    # 执行以下命令,显示版本信息,安装完毕。
    ➜  ~ java -version
    java version "1.8.0_151"
    Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
    Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
    
    #如果提示找不到对应命令添加
    ➜  ~ vim .bash_profile
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk版本/Contents/Home
    export PATH=$PATH:$M2_HOME/bin
    
  • 下载Maven Download

    # 多个PATH变量用冒号分割
    ➜  ~ vim .bash_profile
    export M2_HOME=/Users/lixingping/soft/apache-maven-3.5.2
    export PATH=$PATH:$M2_HOME/bin
    
    # 执行以下命令,显示版本信息,安装完毕。
    ➜  ~ mvn -v
    Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T15:58:13+08:00)
    Maven home: /data/apache-maven-3.5.2
    Java version: 1.8.0_151, vendor: Oracle Corporation
    Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre
    Default locale: zh_CN, platform encoding: UTF-8
    OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"
    

    配置Maven settings.xml

    settings.xml 有两个目录

    1. ~/.m2 用户级配置(如果该目录下面无文件则新建)
    2. $M2_HOME/conf 全局配置

    在settings.xml 文件添加以下内容:

    <?xml version="1.0" encoding="UTF-8"?>
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
      <servers>
        <server>
          <id>github</id>
          <username>cuteJ</username>
          <password>b5bbc403f1b807e64a606bb98af0ab60f5302e67</password>
        </server>
      </servers>
      <mirrors>
        <mirror>
          <id>nexus</id>
          <mirrorOf>central</mirrorOf>
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        </mirror>
      </mirrors>
      <profiles>
    
        <profile>
          <id>github</id>
          <repositories>
            <repository>
              <id>github</id>
              <name>GitHub OWNER Apache Maven Packages</name>
              <url>https://maven.pkg.github.com/cuteJ/ot-server-parent</url>
              <releases>
                <enabled>true</enabled>
              </releases>
              <snapshots>
                <enabled>true</enabled>
              </snapshots>
            </repository>
          </repositories>
        </profile>
      </profiles>
    
      <activeProfiles>
        <activeProfile>github</activeProfile>
      </activeProfiles>
    </settings>
    
    
  • Git Download

    • 全局配置

      git config --global user.name <your name>
      git config --global user.email <your_email@example.com>
      
    • 建议配置

      • crlf
      # windows系统
      git config --global core.autocrlf true
      # mac系统
      git config --global core.autocrlf input
      git config credential.helper store
      
  • 开发工具 intellij idea

  • 数据库(选择相应平台安装安装) Mysql

  • 安装NodeJs Download

    # 显示版本则安装成功
    ➜  ~ npm -v
    5.6.0
    

启动项目

  • 下载前后端项目

    git clone https://github.com/cuteJ/shop-server.git
    
  • 创建数据库并初始化数据

    # 项目install 目录下两个文件
    shop-server/install/sql
    								---- db.sql // 创建数据库和用户
    								---- data.sql // 项目表结构和初始化数据
    
  • 启动后端项目(maven.pkg.github.com下载有点慢,请有心理准备

版权声明:本文为sky233原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/sky233/p/12901296.html