• 如何解决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>
    
     
  • 相关阅读:
    简单后台登录逻辑实现Controller
    自学semantic UI个人博客首页模板
    Spring Boot日志处理
    Thymeleaf静态资源引入方式及公共页面代码抽取
    一个简单SpringBoot应用的pom.xml文件
    Spring Boot入门程序
    easyuUI实现客户分页显示逻辑分析
    easyui自学模板代码
    网络协议-webService协议
    【转】彻底搞透Netty框架
  • 原文地址:https://www.cnblogs.com/sddai/p/6375922.html
Copyright © 2020-2023  润新知