sbt 程序集无法创建 jar 并获取 java.lang.UnsupportedOperationException

igx*_*igx 9 java scala sbt sbt-assembly sbt-plugin

我在用

scala 1.12.10
akka 2.6.3
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.1.0")
Run Code Online (Sandbox Code Playgroud)

但是,在执行时sbt assembly我得到:

java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
    at java.base/java.lang.System.setSecurityManager(System.java:416)
    at sbt.TrapExit$.installManager(TrapExit.scala:53)
    at sbt.StandardMain$.runManaged(Main.scala:109)
    at sbt.xMain.run(Main.scala:76)
    at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:111)
    at xsbt.boot.Launch$.withContextLoader(Launch.scala:131)
    at xsbt.boot.Launch$.run(Launch.scala:111)
    at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:37)
    at xsbt.boot.Launch$.launch(Launch.scala:120)
    at xsbt.boot.Launch$.apply(Launch.scala:20)
    at xsbt.boot.Boot$.runImpl(Boot.scala:56)
    at xsbt.boot.Boot$.main(Boot.scala:18)
    at xsbt.boot.Boot.main(Boot.scala)
[error] [launcher] error during sbt launcher: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
Run Code Online (Sandbox Code Playgroud)

运行java 18

java -version
openjdk version "18" 2022-03-22
OpenJDK Runtime Environment (build 18+36-2087)
OpenJDK 64-Bit Server VM (build 18+36-2087, mixed mode, sharing)
Run Code Online (Sandbox Code Playgroud)

igx*_*igx 7

按照 AminMal 的建议,使用 java 8 解决了这个问题


Fil*_*rrù 6

我在查看旧的 Scala 项目时遇到了这个问题。解决方案是更改project/build.properties文件。

前:

sbt.version=1.2.4
Run Code Online (Sandbox Code Playgroud)

后:

sbt.version=1.6.2
Run Code Online (Sandbox Code Playgroud)