"不支持不安全的HTTP请求"Scala中的错误 [英] "Insecure HTTP request is unsupported" Error in Scala
问题描述
尝试运行 sbt run
来运行我的Scala代码时,出现以下错误:
I am getting the following error when attempting to run sbt run
to run my Scala code:
不安全的HTTP请求不受支持'http://repo.typesafe.com/typesafe/releases';切换为HTTPS或以("http://repo.typesafe.com/typesafe/releases"处的"typesafe-releases")选择加入.withAllowInsecureProtocol(true),或在存储库文件中使用allowInsecureProtocol
这很奇怪,因为上周它运行良好,并且我对代码没有做任何更改.我尝试在 build.sbt
文件和解析程序文件,安装Java11,删除我的项目文件夹,并从存储库中完全重新获得我的代码,但是没有任何效果.我使用的是Visual Studios,但也尝试使用IntelliJ并得到相同的错误.
This is strange because it was working perfectly fine last week and I have changed nothing in the code. I have tried adding ("typesafe-releases" at "http://repo.typesafe.com/typesafe/releases").withAllowInsecureProtocol(true)
in my build.sbt
file and resolver file, installing Java11, deleting my project folder, and completely reclone my code from the repository but nothing is working. I am using Visual Studios but have also tried on IntelliJ and get the same error.
任何建议将不胜感激,因为我什么都没做,现在突然我的代码不再编译了.进一步的细节:
Any advice would be greatly appreciated, as I have changed nothing and now suddenly my code doesn't compile anymore. Further details:
sbt.version = 1.4.0
sbt.version = 1.4.0
Scala代码运行程序版本2.12.10
Scala code runner version 2.12.10
我当前的build.sbt(请注意,当我的代码运行正常时,我之前没有添加解析部分.添加它是为了解决问题,但没有用):
My current built.sbt (please note that I did not have the resolve part added before, when my code was working fine. It was added as an attempt to resolve the issue but did not work):
scalaVersion := "2.12.10"
name := "name"
organization := "org"
version := "1.0"
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2",
"org.apache.spark" %% "spark-core" % "3.0.1",
"org.apache.spark" %% "spark-sql" % "3.0.1",
"org.reactivemongo" %% "reactivemongo-bson-api" % "0.20.11",
"org.mongodb.spark" %% "mongo-spark-connector" % "3.0.0",
"com.ibm.db2.jcc" % "db2jcc" % "db2jcc4"
)
resolvers += Resolver.typesafeRepo("releases")
我发现无论项目如何,都会发生此错误,甚至当我仅自行运行sbt时也会发生.
I've discovered that this error occurs regardless of project, and even occurs when I simply run sbt by itself.
推荐答案
您是否尝试删除〜/.sbt文件夹?我在此文件夹中有一个存储库文件,该文件具有对类型安全存储库的HTTP引用,删除此文件夹可解决这些sbt HTTP错误.
Did you try deleting ~/.sbt folder? I had a repositories file in this folder that had HTTP references to the typesafe repo and deleting this folder resolved those sbt HTTP errors.
这篇关于"不支持不安全的HTTP请求"Scala中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!