一、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.自定义下载位置,在sbtconfsbtconfig.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/"