Maven Windows 配置

Maven Windows 配置

Maven 仓库timeOut 问题

Scala 工程打包发布依赖

repo1.maven.org\maven2\org\scalaz\scalaz-core_2.12\7.2.14

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[error] lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] https://repo1.maven.org/maven2/org/scalaz/scalaz-core_2.12/7.2.14/scalaz-core_2.12-7.2.14.jar: wrong checksum: C:\Users\Administrator\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scalaz\scalaz-core_2.12\7.2.14\scalaz-core_2.12-7.2.14.jar (expected SHA-1 71066d053b1e2ced2ce7476c0716eedb4f36d634 in C:\Users\Administrator\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scalaz\scalaz-core_2.12\7.2.14\.scalaz-core_2.12-7.2.14.jar__sha1, got 479f9b2484893c97063ce9510be0f6f3eae2edaa)
[error]
[error] at lmcoursier.internal.shaded.coursier.Artifacts$.$anonfun$fetchArtifacts$8(Artifacts.scala:359)
[error] at lmcoursier.internal.shaded.coursier.util.Task$.$anonfun$flatMap$2(Task.scala:14)
[error] at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307)
[error] at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
[error] at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] Caused by: lmcoursier.internal.shaded.coursier.cache.ArtifactError$WrongChecksum: wrong checksum: C:\Users\Administrator\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scalaz\scalaz-core_2.12\7.2.14\scalaz-core_2.12-7.2.14.jar (expected SHA-1 71066d053b1e2ced2ce7476c0716eedb4f36d634 in C:\Users\Administrator\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scalaz\scalaz-core_2.12\7.2.14\.scalaz-core_2.12-7.2.14.jar__sha1, got 479f9b2484893c97063ce9510be0f6f3eae2edaa)
[error] at lmcoursier.internal.shaded.coursier.cache.FileCache.$anonfun$validateChecksum$4(FileCache.scala:749)
[error] at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659)
[error] at scala.util.Success.$anonfun$map$1(Try.scala:255)
[error] at scala.util.Success.map(Try.scala:213)
[error] at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
[error] at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
[error] at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
[error] at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (update) lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] https://repo1.maven.org/maven2/org/scalaz/scalaz-core_2.12/7.2.14/scalaz-core_2.12-7.2.14.jar: wrong checksum: C:\Users\Administrator\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scalaz\scalaz-core_2.12\7.2.14\scalaz-core_2.12-7.2.14.jar (expected SHA-1 71066d053b1e2ced2ce7476c0716eedb4f36d634 in C:\Users\Administrator\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scalaz\scalaz-core_2.12\7.2.14\.scalaz-core_2.12-7.2.14.jar__sha1, got 479f9b2484893c97063ce9510be0f6f3eae2edaa)
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

方法一

更新 C:\Users\Administrator.m2 下的settings.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<mirrors>
<mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>        
    </mirror>
    <mirror>
         <id>nexus-osc</id>
          <mirrorOf>central</mirrorOf>
        <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>
</mirrors>

方法二

在中国,sbt访问maven-central很慢,可以改用阿里云的maven repository,或者jcenter作为备选
在.sbt目录下,新建或修改repositories文件

1
2
3
4
5
[repositories]
local
aliyun: http://maven.aliyun.com/nexus/content/groups/public
jcenter: http://jcenter.bintray.com
typesafe: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly

方法三:

如果上面两个都不行,手动下载

打开https://mvnrepository.com/ 搜索 scalaz-core 找到需要下载的版本手动下载,也可以复制链接用迅雷下载

覆盖本地
C:\Users\Administrator\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scalaz\scalaz-core_2.12\7.2.14\scalaz-core_2.12-7.2.14.jar

重新编译pass

评论