How to run a Scala script within IntelliJ IDEA?

前端 未结 4 1984
野的像风
野的像风 2021-02-05 02:05

Here is a trivial scala script:

object test {
  def hi() { print(\"hi there from here\") }
}


test.hi()

From the command line it does the expe

4条回答
  •  星月不相逢
    2021-02-05 02:59

    The answer here is a combination of items:

    • (a) create a brand new Scala project (as suggested by @lhuang) and
    • (b) when running a script, you need to go into the Run Configuration and remove the Make step (as mentioned in the 'related' SOF question).

    This shows rough edges with Intellij and its scala plugin. Especially when I want to integrate scala with java it is apparently difficult if even possible using Intellij at this time (need to create new Scala project on a frequent basis is a non-starter for mostly java projects attempting to incorporate scala).

    But for scala-first projects it seems this may be workable.

提交回复
热议问题