拉取代码前的准备工作
安装JDK;数据库本地可视化客户端(如Navicat、SQLyog、DBeaver、Workbench )、Windows连接linux终端工具(Xshell、SecureCRT、Putty)
下载IDEA——配置IDEA开发环境
- maven路径配置、setting文件配置及仓库配置
可配置本地仓库、公司私有仓库和中央仓库
1、本地仓库,也就是maven_home的地址
<!--本地仓库,每个人设置的可能不一样--> <localRepository>D:\dev\repository</localRepository>
2、公司的私有仓库配置
<?xml version="1.0" encoding="UTF-8"?> <settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <servers> <server> <username>你的用户名</username> <password>你的密码</password> <id>central</id> </server> <server> <username>你的用户名</username> <password>你的密码</password> <id>snapshots</id> </server> </servers> <profiles> <profile> <repositories> <repository> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>libs-release</name> <url>http://ip:端口/artifactory/libs-release</url> </repository> <repository> <snapshots /> <id>snapshots</id> <name>libs-snapshot</name> <url>http://ip:端口/artifactory/libs-snapshot</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>plugins-release</name> <url>http://ip:端口/artifactory/plugins-release</url> </pluginRepository> <pluginRepository> <snapshots /> <id>snapshots</id> <name>plugins-snapshot</name> <url>http://ip:端口/artifactory/plugins-snapshot</url> </pluginRepository> </pluginRepositories> <id>artifactory</id> </profile> </profiles> <activeProfiles> <activeProfile>artifactory</activeProfile> </activeProfiles> </settings>
可参考:https://www.jianshu.com/p/dfd02fa239e2
3、以下是某位大佬关于阿里云镜像仓库的配置文件参考,转自:https://www.cnblogs.com/Narule/p/12595960.html
<?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"> <!-- 此处修改maven_home地址 --> <localRepository>E:\data\code\maven_home</localRepository> <mirrors> <!-- 阿里云仓库 <mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> </mirror> --> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> <!-- 中央仓库1 <mirror> <id>repo1</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo1.maven.org/maven2/</url> </mirror> --> <!-- 中央仓库2 <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> --> <!-- <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> --> <!-- <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> --> </mirrors> <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> </settings>
- 安装插件
如果需要lombok(注解)、Grep Console(彩色控制台)、Translation(翻译)、Alibaba Cloud Toolkit(部署)等插件,下载配置
- 可配置git的路径、开通代码权限,git拉取代码(参考:git相关命令大全)
- maven 打包,启动项目
开始时打包没成功,系统打包的时候需要指定一些参数:
mvn clean install -Denv=dev -DappId=指定的appId号码 -Dmaven.test.skip=true
启动的时候也要加一下启动参数:-Denv=dev -DappId=指定的appId号码
//控制台log显示颜色 -Denv=dev -Dspring.output.ansi.enabled=ALWAYS
- swagger访问SpringBoot项目地址
远程:http://id地址:端口号/项目名/swagger-ui.html
本地:http://localhost:端口号/项目名/swagger-ui.html
端口号为:yml文件中server:port: 8080,配置的端口号
项目名为:yml文件中server:servlet:contextPath: /dev,设置的名称