Error while importing sbt project:--創建sbt項目導入文件出錯


錯誤截圖如下:

 

Error while importing sbt project:

List([info] Loading global plugins from C:\Users\RYJ\.sbt\1.0\plugins
[warn] insecure HTTP request is deprecated 'http://maven.aliyun.com/nexus/content/groups/public'; switch to HTTPS or opt-in as ("aliyun" at "http://maven.aliyun.com/nexus/content/groups/public").withAllowInsecureProtocol(true)
[warn] insecure HTTP request is deprecated 'http://maven.aliyun.com/nexus/content/groups/public'; switch to HTTPS or opt-in as ("aliyun" at "http://maven.aliyun.com/nexus/content/groups/public").withAllowInsecureProtocol(true)
[warn] insecure HTTP request is deprecated 'http://maven.aliyun.com/nexus/content/groups/public'; switch to HTTPS or opt-in as ("aliyun" at "http://maven.aliyun.com/nexus/content/groups/public").withAllowInsecureProtocol(true)
[warn] insecure HTTP request is deprecated 'Patterns(ivyPatterns=Vector(http://repo.typesafe.com/typesafe/ivy-releases/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=Vector(http://repo.typesafe.com/typesafe/ivy-releases/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false)'; switch to HTTPS or opt-in as Resolver.url("typesafe-ivy-releases", url(...)).withAllowInsecureProtocol(true)
[info] Loading project definition from F:\Code\Java\SbtObj\project
[warn] insecure HTTP request is deprecated 'http://maven.aliyun.com/nexus/content/groups/public'; switch to HTTPS or opt-in as ("aliyun" at "http://maven.aliyun.com/nexus/content/groups/public").withAllowInsecureProtocol(true)
[warn] insecure HTTP request is deprecated 'http://maven.aliyun.com/nexus/content/groups/public'; switch to HTTPS or opt-in as ("aliyun" at "http://maven.aliyun.com/nexus/content/groups/public").withAllowInsecureProtocol(true)
[warn] insecure HTTP request is deprecated 'Patterns(ivyPatterns=Vector(http://repo.typesafe.com/typesafe/ivy-releases/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=Vector(http://repo.typesafe.com/typesafe/ivy-releases/[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false)'; switch to HTTPS or opt-in as Resolver.url("typesafe-ivy-releases", url(...)).withAllowInsecureProtocol(true)
[warn] insecure HTTP request is deprecated 'http://maven.aliyun.com/nexus/content/groups/public'; switch to HTTPS or opt-in as ("aliyun" at "http://maven.aliyun.com/nexus/content/groups/public").withAllowInsecureProtocol(true)
[info] Loading settings for project sbtobj from build.sbt ...
[info] Set current project to SbtObj (in build file:/F:/Code/Java/SbtObj/)
[info] sbt server started at local:sbt-server-74de12ff202df04b48d5
sbt:SbtObj>
[info] Defining Global / sbtStructureOptions, Global / sbtStructureOutputFile and 1 others.
[info] The new values will be used by cleanKeepGlobs
[info]     Run `last` for details.
[info] Reapplying settings...
[info] Set current project to SbtObj (in build file:/F:/Code/Java/SbtObj/)
[info] Applying State transformations org.jetbrains.sbt.CreateTasks from C:/Users/RYJ/.IntelliJIdea2019.3/config/plugins/Scala/repo/org.jetbrains/sbt-structure-extractor/scala_2.12/sbt_1.0/2018.2.1+4-88400d3f/jars/sbt-structure-extractor.jar
[info] Reapplying settings...
[info] Set current project to SbtObj (in build file:/F:/Code/Java/SbtObj/)
[warn] insecure HTTP request is deprecated 'http://maven.aliyun.com/nexus/content/groups/public'; switch to HTTPS or opt-in as ("aliyun" at "http://maven.aliyun.com/nexus/content/groups/public").withAllowInsecureProtocol(true)
[warn] insecure HTTP request is deprecated 'http://maven.aliyun.com/nexus/content/groups/public'; switch to HTTPS or opt-in as ("aliyun" at "http://maven.aliyun.com/nexus/content/groups/public").withAllowInsecureProtocol(true)
[error] stack trace is suppressed; run 'last update' for the full output
[error] stack trace is suppressed; run 'last ssExtractDependencies' for the full output
[error] (update) lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.1/scala-compiler-2.13.1.jar: wrong checksum: C:\Users\RYJ\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scala-lang\scala-compiler\2.13.1\scala-compiler-2.13.1.jar (expected SHA-1 2669fd1abfe2c76de9201174255f8454aa25c3e2 in C:\Users\RYJ\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scala-lang\scala-compiler\2.13.1\.scala-compiler-2.13.1.jar__sha1, got 1b073ccae686e76f296677dea625a1abd7e0eaac)
[error] (ssExtractDependencies) lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.1/scala-compiler-2.13.1.jar: wrong checksum: C:\Users\RYJ\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scala-lang\scala-compiler\2.13.1\scala-compiler-2.13.1.jar (expected SHA-1 2669fd1abfe2c76de9201174255f8454aa25c3e2 in C:\Users\RYJ\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scala-lang\scala-compiler\2.13.1\.scala-compiler-2.13.1.jar__sha1, got 1b073ccae686e76f296677dea625a1abd7e0eaac)
[error] Total time: 1 s, completed 2020-3-25 19:43:14
[info] shutting down sbt server)

 

 解決方案:

1.更換鏡像為國內

由於牆的問題,需要把下載源改為國內鏡像,上面截圖是我改過的,如果你改過也不行,直接看解決方案2.。

在.sbt項目下 (.sbt項目可以在文件管理器中直接搜索,默認是在C:\Users\用戶名\.sbt 下) 面創建repositories文件(注意不需要任何后綴),然后添加如下內容:

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

其它不用動,重新右鍵Reimport sbt Project運行看看,可以看到鏡像已經從阿里雲下載了。 當然了,這步設置好可能還是報錯,沒事,看第二個解決方案。

2.降低軟件包版本

上面還是報錯很大原因推測是下載的文件不存在或者找不到導致的,有可能你安裝的這個文件太新了,國內鏡像庫還沒同步過來,國外又訪問不了,所以降低版本就行了。

 修改項目中的build.sbt文件,這里我因為是scala報錯了,所以將 scalaVersion := "2.13.1" 改為 scalaVersion := "2.12.10", 然后保存,發現已經可以了。

 


免責聲明!

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



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