IntellIJ IDEA配置Maven以及修改默认Repository

Laughing
2019-07-18 / 0 评论 / 1,997 阅读 / 搜一下 / 正在检测是否收录...

修改Maven仓库路径

  1. 在D盘(个人根据自身情况而定)新建文件
  2. 配置D:\server\maven\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">  
      
    <pluginGroups />  
    <proxies />  
    <servers />  
      
    <localRepository>D:/server/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>  

IntellIJ IDEA 中配置Maven

Idea 自带了apache maven,默认使用的是内置maven,所以我们可以配置全局setting,来调整一下配置,比如远程仓库地址,本地编译环境变量等。

  1. 打开Settings,在输入框输入maven,
  2. 如果本地设置了MAVEN_OPTS 系统环境变量,这个步骤可以忽略。
  3. 如果配置了本地apache-maven setting.xml 中的软件源,这步骤可以忽略。
1

评论 (0)

取消
  1. 头像
    Laughing 作者
    Windows 10 · Google Chrome

    画图

    回复
  2. 头像
    fdsfs
    MacOS · Google Chrome

    fadsfsf厉害啦啊

    回复