Maven配置仓库的问题

Maven配置仓库的问题

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

1、下载mavenmaven下载地址

Maven配置仓库的问题_第1张图片

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

3、配置环境变量并测试

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

Maven配置仓库的问题_第2张图片

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

Maven配置仓库的问题_第3张图片

将%MAVEN_HOME%\bin追加到PATH路径中

Maven配置仓库的问题_第4张图片

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

Maven配置仓库的问题_第5张图片

4、配置settings.xml

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

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

image-20200618171224775



    
    
    
    
    
    
    D:\Idea 2019\idea\IntelliJ IDEA 2019.3.3\plugins\maven\lib\apache-maven-3.6.3\repository
    
    
        
            alimaven
            central
            aliyun maven
            http://maven.aliyun.com/nexus/content/repositories/central/
        
        
            alimaven
            aliyun maven
            http://maven.aliyun.com/nexus/content/groups/public/
            central
        
        
            central
            Maven Repository Switchboard
            http://repo1.maven.org/maven2/
            central
        
        
            repo2
            central
            Human Readable Name for this Mirror.
            http://repo2.maven.org/maven2/
        
        
            ibiblio
            central
            Human Readable Name for this Mirror.
            http://mirrors.ibiblio.org/pub/mirrors/maven2/
        
        
            jboss-public-repository-group
            central
            JBoss Public Repository Group
            http://repository.jboss.org/nexus/content/groups/public
        
        
            google-maven-central
            Google Maven Central
            https://maven-central.storage.googleapis.com
            central
        
        
        
            maven.net.cn
            oneof the central mirrors in china
            http://maven.net.cn/content/groups/public/
            central
        
        
        
      			mirrorId
     				repositoryId
      			Human Readable Name for this Mirror.
      			http://my.repository.com/repo/path
    		
    


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

Maven配置仓库的问题_第6张图片

ok了!

你可能感兴趣的:(Maven配置仓库的问题)