zoukankan      html  css  js  c++  java
  • Maven配置仓库的问题

    Maven配置仓库的问题

    最近用到IDEA,好多人说导包出问题,在此记录一下

    1、下载mavenmaven下载地址

    image-20200618163634366

    2、解压,路径尽量不要有中文

    3、配置环境变量并测试

    创建MAVEN_HOME环境变量,指向maven的安装目录

    image-20200618165523225

    创建MAVEN_OPTS,内容: -Xms128m -Xmx512m -Duser.language=zh -Dfile.encoding=UTF-8

    image-20200618170002081

    将%MAVEN_HOME%in追加到PATH路径中

    image-20200618165906681

    测试是否安装成功,在cmd中输入 mvn -version

    image-20200618170323036

    4、配置settings.xml

    因为源的问题,原来的镜像导入依赖可能会失败,所以我们改用别的,打开解压路径下的configsetting.xml,改为以下的

    注意这儿的路径,还是你的解压路径下的repository,如果没有这个文件夹,手动创建

    image-20200618171224775

    <?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 />
        
        <!-- maven自动下载的jar包,会存放到该目录下 -->
        <localRepository>D:Idea 2019ideaIntelliJ IDEA 2019.3.3pluginsmavenlibapache-maven-3.6.3
    epository</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>
            
            <mirror>
          			<id>mirrorId</id>
         				<mirrorOf>repositoryId</mirrorOf>
          			<name>Human Readable Name for this Mirror.</name>
          			<url>http://my.repository.com/repo/path</url>
        		</mirror>
        </mirrors>
    </settings>
    
    

    5、在IDEA里设置maven仓库路径

    image-20200618115325163

    ok了!

  • 相关阅读:
    微信公众平台开发(6) 微信退款接口
    shiro 认证和授权原理
    Shiro架构
    微信公众平台开发(5) 微信客服消息接口
    微信公众平台开发(4) 微信模板消息接口
    微信公众平台开发(3) 企业付款
    微信公众平台开发(1) 通用的工具类CommonUtil
    spring 源码构建
    springMvc配置拦截器无效
    IIdea使用CXF开发WebService
  • 原文地址:https://www.cnblogs.com/P935074243/p/13158647.html
Copyright © 2011-2022 走看看