• 如何解决Maven速度慢


    注:oschina已失效

    Maven 远程仓库

        <mirror>  
          <id>ui</id>  
          <mirrorOf>central</mirrorOf>  
          <name>Human Readable Name for this Mirror.</name>  
          <url>http://uk.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>CN</id>
          <name>OSChina Central</name>                                    
          <url>http://maven.oschina.net/content/groups/public/</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>
    

    说明:

    1. 上面的地址前面三个只适合maven,sbt的ivy不适合,sbt需要的jar包在里面会找不到,从下面的配置可以看出。
    2. oschina的镜像虽然都适用,但是访问速度真是慢
    3. 最全面的仓库在校园网完全没办法访问

    SBT

    修改SBT的远程仓库地址有很多办法,这里采用直接修改sbt-lauch.jar/sbt/sbt.boot.properties的方式

    [scala]
      version: ${sbt.scala.version-auto}
    
    [app]
      org: ${sbt.organization-org.scala-sbt}
      name: sbt
      version: ${sbt.version-read(sbt.version)[0.13.9]}
      class: ${sbt.main.class-sbt.xMain}
      components: xsbti,extra
      cross-versioned: ${sbt.cross.versioned-false}
      resources: ${sbt.extraClasspath-}
    
    [repositories]
      local
        Local-Maven-Repository: file:///D:/Java/java-repositories, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]
        ibiblio-maven:http://maven.ibiblio.org/maven2/
        typesafe-ivy:https://dl.bintray.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext] 
      maven-central
        uk-repository: http://uk.maven.org/maven2/
        jboss-repository: http://repository.jboss.org/nexus/content/groups/public/
    
    [boot]
      directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/}
    
    [ivy]
      ivy-home: D:/Java/java-repositories
      checksums: ${sbt.checksums-sha1,md5}
      override-build-repos: ${sbt.override.build.repos-false}
      repository-config: ${sbt.repository.config-${sbt.global.base-${user.home}/.sbt}/repositories}
    

    说明:

    1. repositories 修改远程仓库地址
    2. typesafe-ivy:目的是兼容ivy地址
    3. ivy-home:指的是本地仓库地址,就是jar存在哪里

    ___________________________________________

    在{maven home/conf/settings.xml}中,在<mirror>节点中添加一下镜像
    
    <mirror>
    
    <id>alimaven</id>
    
    <mirrorOf>central<mirrorOf>
    
    <name>aliyun maven</name>
    
    <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
    
    </mirror>
    

    ——————————————————————————————

    修改  

    ~/.m2/settings.xml

    没有此文件需要自行创建个

    <settings xmlns="http://maven.apache.org/POM/4.0.0"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                                   http://maven.apache.org/xsd/settings-1.0.0.xsd">
      <localRepository/>
      <interactiveMode/>
      <usePluginRegistry/>
      <offline/>
      <pluginGroups/>
      <servers/>
      <mirrors>
        <mirror>
          <id>CN</id>
          <name>OSChina Central</name>
          <url>http://maven.oschina.net/content/groups/public/</url>
          <mirrorOf>central</mirrorOf>
        </mirror>
      </mirrors>
      <proxies/>
      <profiles/>
      <activeProfiles/>
    </settings>


    主要是添加mirros

    <mirrors>
        <mirror>
          <id>CN</id>
          <name>OSChina Central</name>
          <url>http://maven.oschina.net/content/groups/public/</url>
          <mirrorOf>central</mirrorOf>
        </mirror>
      </mirrors>



    同时在线查找包  http://maven.oschina.net/  类似maven官网

    ——————————————————————

    /mavenhome/conf/settings.xml
    
    
    <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>ui</id>  
          <mirrorOf>central</mirrorOf>  
          <name>Human Readable Name for this Mirror.</name>  
          <url>http://uk.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>CN</id>
          <name>OSChina Central</name>                                    
          <url>http://maven.oschina.net/content/groups/public/</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>nexus-osc</id> 
      <mirrorOf>*</mirrorOf>
      <name>Nexus osc</name>
      <url>http://maven.oschina.net/content/groups/public/</url>
    
    </mirror> 
      
        <!-- mirror
         | Specifies a repository mirror site to use instead of a given repository. The repository that
         | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
         | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
         |
        <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>
    
    ~/.m2/settings.xml
    
    <mirrors>
        <mirror>
            <id>nexus-osc</id>
            <mirrorOf>central</mirrorOf><!--这里指定只屏蔽central仓库-->
            <name>Nexus osc</name>
            <url>http://maven.oschina.net/content/groups/public/</url>
        </mirror>
        <mirror>
            <id>nexus-osc-thirdparty</id>
            <mirrorOf>thirdparty</mirrorOf>
            <name>Nexus osc thirdparty</name>
            <url>http://maven.oschina.net/content/repositories/thirdparty/</url>
        </mirror>
    
    
    <mirror>  
          <id>ui</id>  
          <mirrorOf>central</mirrorOf>  
          <name>Human Readable Name for this Mirror.</name>  
          <url>http://uk.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>CN</id>
          <name>OSChina Central</name>                                    
          <url>http://maven.oschina.net/content/groups/public/</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>
        
        </mirrors>
    
     
  • 相关阅读:
    EF Core数据库并发策略
    正确的姿势写ASP .NET WebAPI接口
    ReDoc最完善的API文档
    发布自己的nuget包
    不一样的数组循环
    error setting certificate verify locations: CAfile: C:/Program Files/Git/mingw64/ssl/certs/cabundle.crt CApath: none
    如何在cmd里敲linux命令
    npm安装步骤
    OpenIM在线跑通Demo(web版的)
    [深度学习]PyTorch的文档阅读笔记
  • 原文地址:https://www.cnblogs.com/sddai/p/6375922.html
Copyright © 2020-2023  润新知