【发布时间】:2022-01-22 21:48:04
【问题描述】:
我正在参加在线课程,并被指示将一组练习作为项目导入 IDEA。构建和重建项目后,我无法运行这些类。 有一个单独的入门课程向您展示了如何完成所有这些,并且效果很好,所以我不确定出了什么问题。
The getting started project works fine
我比较了 build.project 文件,发现错误: Errors in the main project for the course
我收到一条关于我在运行时无法解决的问题的消息
sbt sbt版本
在我的项目目录中:
PS M:\School\Scala Applied Part 1> cd .\exercises-applied\
PS M:\School\Scala Applied Part 1\exercises-applied> sbt sbtVersion
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by sbt.TrapExit$ (file:/C:/Users/*/.sbt/boot/scala-2.12.4/org.scala-sbt/sbt/1.1.0/run
_2.12-1.1.0.jar)
WARNING: Please consider reporting this to the maintainers of sbt.TrapExit$
WARNING: System::setSecurityManager will be removed in a future release
[info] Loading project definition from M:\School\Scala Applied Part 1\exercises-applied\project
error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken
(class java.lang.NullPointerException/Cannot invoke "scala.tools.nsc.Global$Run.typerPhase()" because the return value of "scala.tools.nsc.Gl
obal.currentRun()" is null)
我好像找不到
/modules/java.base/java/lang/String.class
在文件结构中,我不知道如何更新它。
【问题讨论】:
-
1.从我所见,您导入了错误的目录(您应该导入了
excercises-applied)以在build.sbt中没有错误(它应该在您的根目录中并且您将Scala Applied Part 1设置为根目录),所以构建是根本没找到。 2. 警告与更新的 JDK 和旧的 SBT 有关,最新的 SBT 修复了该警告。 -
@MateuszKubuszok 非常感谢您!解决了它!
标签: scala intellij-idea sbt