參考文檔:https://blog.csdn.net/weixin_44215249/article/details/117376417?fromshare=blogdetail&sharetype=blogdetail&sharerId=117376417&sharerefer=PC&sharesource=qxpapt&sharefrom=from_link.
spring boot + vue 搭建環境
- 一、瀏覽器
- 二、jdk8安裝及配置
- 三、maven安裝及配置
- 下載安裝maven
- 配置maven環境變量
- 配置本地倉庫
- 配置阿里云的鏡像
- Q&A
- 參考文檔
- 四、 IDEA的安裝及配置
- 下載安裝IDEA
- 五、MySQL的安裝及配置
- 下載安裝MySQL
- 驗證是否安裝成功
- 參考文檔
- 六、node.js安裝及配置
- 下載node.js
- 環境變量配置
- 測試環境變量是否配置成功
- 安裝淘寶鏡像
- Q&A
- 七、git安裝及配置
- git的下載
- 參考文檔
軟件 | 軟件配置版本號 |
---|---|
jdk | jdk-8u181(1.8.0_181)(總是提示版本太低,升級之后的版本是1.8.0_411) |
maven | apache-maven-3.8.8 |
IDEA | ideaIU-2023.3.5 |
MySQL | mysql Ver 8.0.36 |
nodejs | 長期支持版本: 18.19.1-x64.msi |
一、瀏覽器
比較推薦chrome瀏覽器,下載之后可以做這些操作:設置搜索引擎為Bing,設置下載地址,安裝自己需要的擴展插件,導入書簽(如果有)
谷歌瀏覽器下載地址: https://www.google.cn/chrome/index.html.
二、jdk8安裝及配置
參考以下博客:APP測試環境部署:https://blog.csdn.net/qxpapt/article/details/136067615?fromshare=blogdetail&sharetype=blogdetail&sharerId=136067615&sharerefer=PC&sharesource=qxpapt&sharefrom=from_link.
三、maven安裝及配置
maven下載地址: https://maven.apache.org/download.cgi.
下載安裝maven
1、選擇適合的maven下載 ,我下載的是apache-maven-3.8.8 版本
注意:Maven的版本要老于IDEA的版本,否則導入Maven工程時會報錯!
Binary是可執行版本,已經編譯好可以直接使用。
Source是源代碼版本,需要自己編譯成可執行軟件才可使用。
tar.gz格式的文件比zip文件小很多,用于unix操作系統。
zip格式用于Windows操作系統
2、下載解壓縮安裝時必須要解壓到一個沒有中文的沒有空格的文件夾內(很多帶中文路徑會報錯)
配置maven環境變量
1、環境變量配置
點擊【此電腦】-單擊右鍵-【屬性】-【高級系統設置】-【環境變量】
變量名 | 變量值 |
---|---|
M2_HOME | F:\Maven\apache-maven-3.8.8 |
Path | %M2_HOME%\bin或F:\Maven\apache-maven-3.8.8\bin |
a.在系統變量中添加新的變量:進入控制面板》系統》高級系統設置》環境變量(Window11)》新建系統變量》變量值是Maven的解壓地址
b.在path中添加maven的bin目錄,就是你的Maven安裝目錄下的bin文件夾的絕對路徑,便于執行命令,編輯完后點擊確定
2、檢驗環境是否配置成功
win+R運行cmd,在控制臺敲入 mvn -v 命令,出現下列類似內容時,說明配置成功。
配置本地倉庫
本地倉庫存儲著我們每個項目有可能用到的插件和 jar 包, Maven安裝成功后會在C盤下面有個默認的本地倉庫: 它的默認地址是 C:\Users\用戶名.m2(eg:${user.home}/.m2/repository)找到 setings.xml 配置文件,配置其其他位置的本地倉庫:添加: < localRepository >xxx < /localRepository>即可。
1、在Maven解壓路徑同層級創建倉庫目錄repo,用作maven的本地庫,也可以創建在其他地方,創建在Maven下是方便管理
2、配置使用本地倉庫,找到F:\Maven\apache-maven-3.8.8\conf目錄下的settings.xml文件(注意你自己的解壓安裝路徑)
找到節點localRepository,在注釋外添加自己倉庫的位置,這里我添加的是:
<localRepository>F:\Maven\repo</localRepository>
localRepository節點用于配置本地倉庫,本地倉庫其實起到了一個緩存的作用,當我們從maven中獲取jar包的時候,maven首先會在本地倉庫中查找,如果本地倉庫有則返回;如果沒有則從遠程倉庫中獲取包,并在本地庫中保存。此外,我們在maven項目中運行mvn install,項目將會自動打包并安裝到本地倉庫中。
配置阿里云的鏡像
1、在settings.xml配置文件中找到mirrors節點。
2、添加如下配置
國外的服務器下載jar包很慢所以我們改為阿里云服務器,此鏡像為阿里云倉庫鏡像(該鏡像有多個,可以選擇適合自己的)
注意:要添加在和兩個標簽之間,其它配置同理。雖然mirrors可以配置多個子節點,但是它只會使用其中的一個節點,即默認情況下配置多個mirror的情況下,只有第一個生效,只有當前一個mirror無法連接的時候,才會去找后一個。
<!--阿里云倉庫 -->
<mirrors><mirror><id>aliyunmaven</id><mirrorOf>*</mirrorOf><name>阿里云公共倉庫</name><url>https://maven.aliyun.com/repository/public</url></mirror>
</mirrors>
3、下載本地倉庫缺省文件
win+R運行cmd,輸入mvn help:system測試,配置成功則會出現下圖情況,下載的時間可能會有些長,耐心等待一下,下載完成后本地倉庫中會出現一些文件
Q&A
1、報錯信息 這個應該是< localRepository >xxx < /localRepository>路徑寫錯(一定要仔細檢查)
2、 mirrors 節點需要一一對應起來
可以用記事本打開這個配置文件,查看報錯信息,定位代碼是第幾行
參考文檔
Maven的安裝與配置(設置本地Maven倉庫、IDEA配置Maven)
https://blog.csdn.net/hanjmm/article/details/126108846.
mvn help:system報錯總結:
https://blog.csdn.net/qq_47994979/article/details/118249347.
spring boot + vue 搭建開發環境
https://blog.csdn.net/weixin_44215249/article/details/117376417.
我的settings.xml文件配置如下:
<?xml version="1.0" encoding="UTF-8"?><!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--><!--| This is the configuration file for Maven. It can be specified at two levels:|| 1. User Level. This settings.xml file provides configuration for a single user,| and is normally provided in ${user.home}/.m2/settings.xml.|| NOTE: This location can be overridden with the CLI option:|| -s /path/to/user/settings.xml|| 2. Global Level. This settings.xml file provides configuration for all Maven| users on a machine (assuming they're all using the same Maven| installation). It's normally provided in| ${maven.conf}/settings.xml.|| NOTE: This location can be overridden with the CLI option:|| -gs /path/to/global/settings.xml|| The sections in this sample file are intended to give you a running start at| getting the most out of your Maven installation. Where appropriate, the default| values (values used when the setting is not specified) are provided.||-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd"><!-- localRepository| The path to the local repository maven will use to store artifacts.|| Default: ${user.home}/.m2/repository<localRepository>/path/to/local/repo</localRepository>--><localRepository>F:\Maven\repo</localRepository><!-- interactiveMode| This will determine whether maven prompts you when it needs input. If set to false,| maven will use a sensible default value, perhaps based on some other setting, for| the parameter in question.|| Default: true<interactiveMode>true</interactiveMode>--><!-- offline| Determines whether maven should attempt to connect to the network when executing a build.| This will have an effect on artifact downloads, artifact deployment, and others.|| Default: false<offline>false</offline>--><!-- pluginGroups| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.|--><pluginGroups><!-- pluginGroup| Specifies a further group identifier to use for plugin lookup.<pluginGroup>com.your.plugins</pluginGroup>--></pluginGroups><!-- proxies| This is a list of proxies which can be used on this machine to connect to the network.| Unless otherwise specified (by system property or command-line switch), the first proxy| specification in this list marked as active will be used.|--><proxies><!-- proxy| Specification for one proxy, to be used in connecting to the network.|<proxy><id>optional</id><active>true</active><protocol>http</protocol><username>proxyuser</username><password>proxypass</password><host>proxy.host.net</host><port>80</port><nonProxyHosts>local.net|some.host.com</nonProxyHosts></proxy>--></proxies><!-- servers| This is a list of authentication profiles, keyed by the server-id used within the system.| Authentication profiles can be used whenever maven must make a connection to a remote server.|--><servers><!-- server| Specifies the authentication information to use when connecting to a particular server, identified by| a unique name within the system (referred to by the 'id' attribute below).|| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are| used together.|<server><id>deploymentRepo</id><username>repouser</username><password>repopwd</password></server>--><!-- Another sample, using keys to authenticate.<server><id>siteServer</id><privateKey>/path/to/private/key</privateKey><passphrase>optional; leave empty if not used.</passphrase></server>--></servers><!-- mirrors| This is a list of mirrors to be used in downloading artifacts from remote repositories.|| It works like this: a POM may declare a repository to use in resolving certain artifacts.| However, this repository may have problems with heavy traffic at times, so people have mirrored| it to several places.|| That repository definition will have a unique id, so we can create a mirror reference for that| repository, to be used as an alternate download site. The mirror site will be the preferred| server for that repository.|--><!-- mirrors><mirror| Specifies a repository mirror site to use instead of a given repository. The repository that| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.|<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> --><mirror><id>maven-default-http-blocker</id><mirrorOf>external:http:*</mirrorOf><name>Pseudo repository to mirror external repositories initially using HTTP.</name><url>http://0.0.0.0/</url><blocked>true</blocked></mirror><!--阿里云倉庫 -->
<mirrors><mirror><id>aliyunmaven</id><mirrorOf>*</mirrorOf><name>阿里云公共倉庫</name><url>https://maven.aliyun.com/repository/public</url></mirror>
</mirrors><!-- profiles| This is a list of profiles which can be activated in a variety of ways, and which can modify| the build process. Profiles provided in the settings.xml are intended to provide local machine-| specific paths and repository locations which allow the build to work in the local environment.|| For example, if you have an integration testing plugin - like cactus - that needs to know where| your Tomcat instance is installed, you can provide a variable here such that the variable is| dereferenced during the build process to configure the cactus plugin.|| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles| section of this document (settings.xml) - will be discussed later. Another way essentially| relies on the detection of a system property, either matching a particular value for the property,| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.| Finally, the list of active profiles can be specified directly from the command line.|| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact| repositories, plugin repositories, and free-form properties to be used as configuration| variables for plugins in the POM.||--><profiles><!-- profile| Specifies a set of introductions to the build process, to be activated using one or more of the| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>| or the command line, profiles have to have an ID that is unique.|| An encouraged best practice for profile identification is to use a consistent naming convention| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.| This will make it more intuitive to understand what the set of introduced profiles is attempting| to accomplish, particularly when you only have a list of profile id's for debug.|| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.<profile><id>jdk-1.4</id><activation><jdk>1.4</jdk></activation><repositories><repository><id>jdk14</id><name>Repository for JDK 1.4 builds</name><url>http://www.myhost.com/maven/jdk14</url><layout>default</layout><snapshotPolicy>always</snapshotPolicy></repository></repositories></profile>--><!--| Here is another profile, activated by the system property 'target-env' with a value of 'dev',| which provides a specific path to the Tomcat instance. To use this, your plugin configuration| might hypothetically look like:|| ...| <plugin>| <groupId>org.myco.myplugins</groupId>| <artifactId>myplugin</artifactId>|| <configuration>| <tomcatLocation>${tomcatPath}</tomcatLocation>| </configuration>| </plugin>| ...|| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to| anything, you could just leave off the <value/> inside the activation-property.|<profile><id>env-dev</id><activation><property><name>target-env</name><value>dev</value></property></activation><properties><tomcatPath>/path/to/tomcat/instance</tomcatPath></properties></profile>--></profiles><!-- activeProfiles| List of profiles that are active for all builds.|<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>-->
</settings>
四、 IDEA的安裝及配置
下載安裝IDEA
下載地址:https://www.jetbrains.com/idea/download/?section=windows#section=windows.
選擇 Ultimate 版本進行下載安裝,Community 版本為社區版,免費,只支持部分功能(部分通過文章鏈接進官網下載該軟件,可能安裝了漢化插件)
下載完后在本地找到該文件,雙擊運行 idea 安裝程序
修改安裝路徑,我這里修改到了F盤
勾選創建卓main快捷方式
開始安裝
安裝成功進入的界面
選擇New Project這里選擇創建一個空的項目名為Server-side,最后點擊創建即可
成功創建一個project
五、MySQL的安裝及配置
下載安裝MySQL
官網下載地址:https://www.mysql.com/downloads/.
按下圖順序點擊進入下載頁面
注意:這里MSI Installe有兩個,第一個(大小2.4M)是通過聯網在線安裝,會在線下載安裝包;第二個(大小437.3M)是離線安裝。這里選擇第二個(包含32位和64位安裝包),下載到本地后進行安裝。
雙擊下載的安裝包,開始安裝
選擇Service only,點擊Next
點擊Execute,檢測需要的安裝,檢測完畢后,接著點Next
密碼驗證方式(Authentication Method)【重要】
第一個是強密碼校驗,mysql推薦使用最新的數據庫和相關客戶端,MySQL8換了加密插件,所以如果選第一種方式,很可能導致你的navicat等客戶端連不上mysql8;所以一定要選第二個(下圖紅框的地方),選完后點擊next
設置密碼,需要牢記,因為后面要用這個密碼連接數據庫,用戶名為root
輸完密碼后,點擊next繼續。
服務器文件權限(Server File Permissions),選擇第一個
驗證是否安裝成功
1、使用管理員身份打開cmd命令窗口,點擊【開始】菜單,在搜索區域輸入“命令提示符”,然后點擊【以管理員身份運行】
2、在電腦中找到安裝好的MySQL的bin文件目錄 ,我的安裝目錄是:C:\Program Files\MySQL\MySQL Server 8.0\bin
3、在命令提示符中先輸入cd C:\Program Files\MySQL\MySQL Server 8.0\bin 打開目錄,然后輸入mysql -h localhost -u root -p 登錄數據庫,再輸入數據庫密碼,登錄成功查看信息。
輸入 status 命令可以查看 MySQL的 版本信息,說明安裝成功
參考文檔
安裝教程:https://blog.csdn.net/weixin_39289696/article/details/128850498.
六、node.js安裝及配置
下載node.js
1、選擇對應你系統的Node.js版本,這里我選擇的是Windows系統、64位,node.js下載地址:https://nodejs.cn/download/.
2、安裝程序
下載完成后,雙擊安裝包,開始安裝Node.js,直接點擊【Next】
直接點擊【Next】按鈕,可根據個人需求修改安裝路徑,我一般不會將這些軟件放在C盤,以免造成卡頓
可根據自身需求進行,此處我選擇默認安裝,繼續點擊【Next】按鈕
直接點擊【Next】按鈕
點擊【Install】按鈕進行安裝
安裝完畢,點擊【Finish】按鈕
3、測試是否安裝成功
按下【win+R】鍵,輸入cmd,打開cmd窗口
//命令行輸入
node -v // 顯示node.js版本npm -v // 顯示npm版本//--成功顯示版本說明安裝成功
環境變量配置
1、創建文件夾
找到剛剛nodejs的安裝目錄,在安裝目錄下新建兩個文件夾【node_global】和【node_cache】
創建完畢后,使用管理員身份打開cmd命令窗口,點擊【開始】菜單,在搜索區域輸入“命令提示符”,然后點擊【以管理員身份運行】
在命令行輸入以下命令
//npm config set prefix “nodejs的安裝路徑\node_global” (復制你剛剛創建的“node_global”文件夾路徑)
npm config set prefix "F:\nodejs\node_global"
//npm config set cache “nodejs的安裝路徑\node_cache” (復制你剛剛創建的“node_cache”文件夾路徑)
npm config set cache "F:\nodejs\node_cache"
2、配置環境變量
環境變量參數如下:
變量名 | 變量值 |
---|---|
NODE_PATH | F:\nodejs\node_global\node_modules |
Path(系統變量) | %NODE_PATH% |
Path(用戶變量) | F:\nodejs\node_global |
【此電腦】-單擊右鍵-【屬性】-【高級系統設置】-【環境變量】-系統變量-新建
添加變量名為NODE_PATH的系統變量,查看【nodejs的安裝路徑\node_global】下是否多出【node_modules】的文件夾(我的路徑是F:\nodejs\node_global)。 如果輸入變量值之后沒有自動創建【node_modules】文件夾,就在【node_global】下手動創建一個【node_modules】文件夾,再復制你創建的【node_modules】文件夾的路徑地址到變量值
在【系統變量】中選擇【Path】點擊【編輯】-【新建】添加【%NODE_PATH%】,隨后一直點擊【確定】
在【用戶變量】選擇【Path】點擊【編輯】
將默認的 C 盤下【 AppData\Roaming\npm 】修改成 【node_global】的路徑,點擊確定
測試環境變量是否配置成功
配置完成后,使用管理員身份打開cmd命令窗口(以下所有命令窗口都是管理員身份打開),點擊【開始】菜單,在搜索區域輸入“命令提示符”,然后點擊【以管理員身份運行】,全局安裝一個最常用的 express(npm install express -g) 模塊進行測試
npm install express -g // -g代表全局安裝
/*更新npm*/
npm install -g npm
出現以下界面即為配置成功
Tips:如果出現報錯,請將報錯信息百度一下,通過報錯排查問題,是最快的解決路徑。(因為我每次都不會看報錯信息,只是百度命令導致不好定位問題,找到解決辦法)
安裝好的npm、express會出現在【node_global】下的【node_modules】文件夾里
安裝淘寶鏡像
以管理員身份在命令窗口運行以下命令:
npm config set registry https://registry.npm.taobao.org
/*npm是node官方的包管理器 查看是否安裝成功*/
npm config get registry
為什么安裝淘寶鏡像? 它通過緩存和鏡像npm的公開倉庫來提供更快的下載速度。
當你在項目中配置了淘寶鏡像后,所有的npm包都將從鏡像站點下載,而不是從原始的npm倉庫下載。 這大大提高了下載速度,特別是在中國地區。
要使用淘寶鏡像,你需要在npm配置中設置registry為淘寶提供的鏡像地址
安裝成功如下圖所示
Q&A
npm install express -g 總是報錯 // -g代表全局安裝總是報錯
1、沒有使用管理員身份運行cmd窗口
未使用管理員身份運行cmd報錯,如下圖:
2、修改一下【node_global】和【node_cache]的權限
修改【node_global】和【node_cache]的權限, 鼠標右擊【node_global】的文件夾,點擊【屬性】,再點擊【安全】,再點擊【編輯】,將權限都勾上,隨即點擊【確定】即可,【node_cache】步驟同理。
3、以上兩種都沒有解決問題的話,我就使用了第三種
以管理員身份運行以下命令后,執行npm install express -g,安裝成功
/*查看當前系統時間*/
date
/*查看返回系統時間是否正確*/
/*如果不正確使用以下命令來設置系統時間。
例如,如果你想將系統時間設置為2023年3月16日,你可以輸入以下命令:*/
date 2023-03-16
/*清除npm的緩存*/
npm cache clean --force
/*更新npm*/
npm install -g npm
注意:有人說還要取消證書驗證,執行第二行代碼,但是npm config set strict-ssl false會繞過ssl驗證導致連接容易受他人攻擊,有安全風險。不得已的方法才會這么做,建議有其他優先解決的方法還是用其他方法
npm cache clean --force
npm config set strict-ssl false
npm install
4、還有一個輸入命令的時候我把后面的注釋也復制上去了,總是安裝失敗,要刪掉注釋
參考文檔
報錯教程:https://blog.csdn.net/tombosky/article/details/135835362.
安裝教程:https://blog.csdn.net/WHF__/article/details/129362462.
七、git安裝及配置
git的下載
git下載地址:https://git-scm.com/download/.
使用Windows系統自帶的瀏覽器Edge訪問git下載地址,能夠自動識別電腦的操作系統,點擊“Download for windows”或者“Windows”即可到Git版本頁面。
查看電腦是多少位的操作系統(查看方式:此電腦》屬性》系統》系統信息)來確定下載什么版本的git
Git for Windows Setup和Git for Windows Portable(便攜版)兩個版本都
可以,我選擇的是64bit基本版本,選擇"64-bit Git for Windows Setup"。
Git Portable是針對windows版git所設計的一款軟件,是便攜版或移動版的git。你可以選擇將它安裝在U盤等便攜設備上。它不需要安裝,也不會在注冊表上留下記錄。正因為這樣,你也無法像桌面版的git那樣,使用右鍵“git Bash here”或者“git GUI here”。
參考文檔
git的安裝與下載:https://blog.csdn.net/mukes/article/details/115693833.
配置參考教程:https://zhuanlan.zhihu.com/p/443527549.