安装Maven
安装Maven之前需要安装JDK。
打开页面选择适合的版本 http://maven.apache.org/download.cgi#
检查Java环境变量
echo %JAVA_HOME%
C:\Program Files\Java\jdk1.7.0_51
添加Maven环境变量
MAVEN_HOME=E:\apache-maven-3.5.0
MAVEN_OPTS=-Xms1G -Xmx3G -XX:PermSize=256m -XX:MaxPermSize=520M
在path变量末尾加入%MAVEN_HOME%\bin
测试Maven环境变量
echo %MAVEN_HOME%
E:\apache-maven-3.5.0
echo %MAVEN_OPTS%
-Xms1G -Xmx3G -XX:PermSize=256m -XX:MaxPermSize=520M
mvn -v
Java HotSpot(TM) Client VM warning: ignoring option PermSize=256m; support was removed in 8.0
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=520M; support was removed in 8.0
Error occurred during initialization of VM
Could not reserve enough space for 3145728KB object heap
到这一步就安装成功了。
配置Maven
我的Maven 目录是 E:\apache-maven-3.5.0
repository目录是 E:\m2\repository
repository目录会下载很多文件就是maven从*仓库下载到本地仓库的文件
修改 maven\conf\setting.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">
<!--这个目录存放下载的java包,改成自己的目录-->
<localRepository>E:/m2/repository</localRepository>
<mirrors>
<!--下载镜像-->
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<profiles>
<profile>
<id>thinkgem</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>thinkgem</activeProfile>
</activeProfiles>
</settings>
拷贝一个setting.xml 到E:\m2\repository