[英]sbt test error: java.lang.RuntimeException: /packages cannot be represented as URI
[英]"/packages cannot be represented as URI"
我正在开发一个 Scala 项目,该项目使用 maven POM.xml 文件进行构建。
添加导入“org.scalatest.FunSuite”或“...Matchers”的测试文件后构建失败,错误消息为“/packages cannot be represented as URI”
插件“scalatest-maven-plugin”在 pom.xml 中使用,但只要没有 FunSuite 或 Matchers 被导入,文件就可以工作
pom 中的测试依赖项如下所示
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.binary.version}</artifactId>
<version>3.0.5</version>
<scope>test</scope>
</dependency>
scala 版本:2.12.7
maven 版本:3.8.6
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
在我的情况下,我通过安装 1.8 的 java 版本并将 JAVA_HOME 设置为此版本解决了这个问题。
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home"
这是 Scala 编译器错误。 请升级到最新的 Scala 点版本,2.12.16。
如果您使用的是 intelliJ
File -> Settings -> Build, Execution, Deployment -> Build Tools -> sbt
Use sbt shell for build
被选中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.