Closed
Description
I'm not sure but I found unexpected behavior after compilation Scala 3
code with SBT
.
build.sbt
looks like:
name := "scala-cheat-sheet"
version := "1.0"
scalaVersion := "3.0.0"
Compile/mainClass := Some("com.okarmusk.Main")
The main object is located under src/main/scala/com/okarmusk
and looks like:
package com.okarmusk
object Main {
def main(args: Array[String]): Unit = {
println("Hello world!")
}
}
I sequentially run commands:
sbt clean
sbt package
scala target/scala-3.0.0/scala-cheat-sheet_3-1.0.jar
As the result I obtained:
Error: Could not find or load main class target.scala-3.0.0.scala-cheat-sheet_3-1.0.jar
Caused by: java.lang.ClassNotFoundException: target.scala-3.0.0.scala-cheat-sheet_3-1.0.jar
Problem exists on scala 3 version Scala code runner version 3.0.1-RC1 -- Copyright 2002-2021, LAMP/EPFL
, on scala 2 example works as expected.
OS: xubuntu 20.04
sbt: 1.5.2
scala: 3.0.1 RC
Issue exists also in official scala 3.0.0 version
It is worth to notice that when I run sbt run
the program executes correctly.