maven與sbt修改國內鏡像


一、idea中的maven

1.打開IntelliJ IDEA->Settings ->Build, Execution, Deployment -> Build Tools > Maven

一個是本地配置文件的位置,另一個是本地倉庫的位置

在.m2下面新建settings.xml文件,內容如下

<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">
    <mirrors>
        <!-- 阿里雲 -->
        <mirror>
            <id>alimaven</id>
            <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
        </mirror>


        <!-- 中央倉庫1 -->
        <mirror>
            <id>repo1</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://repo1.maven.org/maven2/</url>
        </mirror>


        <!--中央倉庫2 -->
        <mirror>
            <id>repo2</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://repo2.maven.org/maven2/</url>
        </mirror>
    </mirrors> 

</settings>

二、sbt

1.在`~/.sbt/`下添加一個`repositories`文件,里面內容如下:

[repositories]
local
aliyun: http://maven.aliyun.com/nexus/content/groups/public/
typesafe: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
sonatype-oss-releases
maven-central
sonatype-oss-snapshots

2.自定義下載位置,在sbt\conf\sbtconfig.txt中末尾添加

-Dsbt.boot.directory=~/sbt-0.13.15/boot
-Dsbt.global.base=~/sbt-0.13.15/.sbt
-Dsbt.ivy.home=~/sbt-0.13.15/.ivy2

3.sbt配置表

4.idea里的sbt

 5.如果只是在單個項目中修改的話,在build.sbt里添加

resolvers += "aliyun" at "http://maven.aliyun.com/nexus/content/groups/public/"


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM