IDEA配置Maven
[TOC]
1.在IDEA需要配置哪些東西
maven程序:IDEA配置maven通俗的講就是在IDEA中使用Maven程序
setting文件:setting就是對Maven程序的一些設置
maven倉庫:就是存放jar包的地方.
2.打開設置面板找到Maven菜單
File → settings 或快捷鍵 (ctrl + alt + s )打開設置面板
-
打開[Build,Execution,Deployment] → [Build Tools] → [Maven] 菜單如下圖所示
img
在這里你需要配置三個參數(shù):
-
Maven home dirctory : 這里設置你的maven安裝路徑
img -
User setting file : 這里是設置配置參數(shù)的XML文件,通常都是在安裝目錄下的conf下的setting.xml文件.如圖
img -
配置 Local repository : 這里是配置本地倉庫地址,配置后maven會先從本地尋找,尋找不到再去網(wǎng)上下載
img -
setting的設置代碼
<?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"> <pluginGroups /> <proxies /> <servers /> <localRepository>D:\develop\maven\repository</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> <mirror> <id>central</id> <name>Maven Repository Switchboard</name> <url>http://repo1.maven.org/maven2/</url> <mirrorOf>central</mirrorOf> </mirror> <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>ibiblio</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url> </mirror> <mirror> <id>jboss-public-repository-group</id> <mirrorOf>central</mirrorOf> <name>JBoss Public Repository Group</name> <url>http://repository.jboss.org/nexus/content/groups/public</url> </mirror> <mirror> <id>google-maven-central</id> <name>Google Maven Central</name> <url>https://maven-central.storage.googleapis.com </url> <mirrorOf>central</mirrorOf> </mirror> <!-- 中央倉庫在中國的鏡像 --> <mirror> <id>maven.net.cn</id> <name>oneof the central mirrors in china</name> <url>http://maven.net.cn/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors> </settings>
另附一張菜單圖解
img