Open cedarbob opened 2 years ago
However, I was able to run Hello, Hello2 via sbt in a terminal window without any problem.
After doing this, the IDE prompted me to reload project changes, which I did. I then repeated my original test by selecting the code for Hello2 in UpperMain2.scala and electing "run Hello2" from the popup - and got a different build error:
/home/rhr/Test/programming-scala-book-code-examples-master/src/main/scala/progscala3/typesystem/bounds/list/AbbrevList.scala:36:18 @targetName annotation "AbbrevListCons" clashes with other definition in same scope final case class ::[B](private var hd: B,
Thanks for the bug reports. I'm leaving a short vacation. I'll look at them when I return.
I didn't use IntelliJ to develop the examples. It appears the second definition of -encoding foo
is in the IntelliJ compiler preferences. To fix:
-encoding utf-8
from the text.After that, I could select a type with a main
and run it.
If you still get the "clashes" error, try running sbt clean
in a terminal, then let IntelliJ build the software. I suspect you had two target
directories, one created by IntelliJ and one created by SBT and both ended up on the class path.
I'll put these comments in the project README, too.
I did see the @targetName
clash when I attempted to use SBT's console
in IntelliJ's set shell
, while I don't see it when I use sbt console
in a separate terminal window. I think that adds weight to my theory that there are two copies of all the classes on the class path, although I didn't investigate further. What works for me is to use sbt console
in a terminal window only.
I get the following build error when I try to run any of the introscala examples (and I assume any of the examples):
scalac: Flag -encoding set repeatedly
I'm attempting to run by simply selecting one of the main methods and electing "run XYZ" in the popup menu with the default scala compiler options in the IDE. I also tried commenting out the "-encoding", "utf-8" scalac option in build.sbt but got the same result.