Warm tip: This article is reproduced from serverfault.com, please click

"Insecure HTTP request is unsupported" Error in Scala

发布于 2020-11-24 15:00:46

I am getting the following error when attempting to run sbt run to run my Scala code:

insecure HTTP request is unsupported 'http://repo.typesafe.com/typesafe/releases'; switch to HTTPS or opt-in as ("typesafe-releases" at "http://repo.typesafe.com/typesafe/releases").withAllowInsecureProtocol(true), or by using allowInsecureProtocol in repositories file

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

Scala code runner version 2.12.10

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")

EDIT: I've discovered that this error occurs regardless of project, and even occurs when I simply run sbt by itself.

Questioner
David Boulton
Viewed
0
Shinoy Sam 2020-11-26 06:45:08

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.