Reputation: 300
I am working on a Scala project that use maven POM.xml file to build.
the build failed after adding test file that import "org.scalatest.FunSuite" or "...Matchers" with error message "/packages cannot be represented as URI"
plugin "scalatest-maven-plugin" is in used in the pom.xml but works file as long as there is no FunSuite or Matchers is imported
the test dependency in the pom looks like this
<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 version: 2.12.7
maven version: 3.8.6
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
Upvotes: 0
Views: 2579
Reputation: 391
If you're using intelliJ
File -> Settings -> Build, Execution, Deployment -> Build Tools -> sbt
Use sbt shell for build
is checkedUpvotes: 1
Reputation: 4587
This is a Scala compiler bug. Please upgrade to the latest Scala point release, 2.12.16.
Upvotes: 4
Reputation: 300
Found the solution:
The Project Build of IntelliJ doesn't really care about the path of JDK in env var JAVA_HOME, it takes the one from project settings, so to solve this I have to:
Upvotes: 2
Reputation: 105
In My Case I had resolved this issue by installing a java version of 1.8 and set JAVA_HOME to this version.
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home"
Upvotes: 0