maven是個好東西,是項目構建和管理的工具。感覺跟anaconda有一拼,都可以很方便的自動把所需要的包搞定,省得自己一個一個去下載,很省事。
記錄下過程,供日後參考使用。
1.配置環境變量
2.配置maven的setting.xml(本地倉庫地址,默認jdk版本,添加國內鏡像源)
3.配置intellij idea
上傳了一份3.6版本的到百度雲盤中,自取
https://pan.baidu.com/s/1XpeVBp8OlhP9BtHKLMdlIw
這是解壓版本,建議放到英文路徑的文件下
1.配置環境變量
然後編輯Path 添加 %MAVEN_HOME%\bin
然後在windows命令行中使用mvn -v查看是否配置成功
看起來貌似是成功了,但是多出來了點東西“cmd”不是內部或外部命令,也不是可運行的程序。 不要慌,估計是環境變量配置的有點問題。搜索一波,發現設置環境變量path的時候,可能覆蓋了原先設置着的變量,所以需要改一下即可。在最前面加上%SystemRoot%\system32;。
接下來,
2.配置setting.xml文件
(1)需要配置Maven的本地倉庫路徑。
在conf的settings.xml這個配置文件中,修改爲自己存放jar包的路徑。
<localRepository>D:\Code\Repository</localRepository>
(2)修改默認的jdk版本
在profiles標籤下添加一個profile標籤,修改maven默認的JDK版本。
<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>
(3)添加國內鏡像源
在mirrors標籤下添加mirror標籤,添加國內鏡像源,提高jar包下載速度
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</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>
3.配置intellij idea
自動導包!配置結束,可以愉快的玩耍了。
參考:https://blog.csdn.net/westos_linux/article/details/78968012
https://blog.csdn.net/huo920/article/details/82082403
寫在最後,可以按這個哥們對idea進行一些簡單的設置
https://www.cnblogs.com/qinxu/p/9323656.html
如果是專業版的intellij idea,破解可以參考這個
https://www.jiweichengzhu.com/article/93afbed1245d4ee69b82ed1b067f48a4