How to start sbt console and automatically evaluate some expressions?

前端 未结 2 793
日久生厌
日久生厌 2021-01-21 02:01

When using sbt console I find myself repeatedly entering some import statements. It would be great if there was a way to tell sbt to always run commands. Is there

相关标签:
2条回答
  • 2021-01-21 02:37

    You can use initialCommands:

    initialCommands in console := """import my.app._
    import my.app.is.sooo.cool._"""
    
    0 讨论(0)
  • 2021-01-21 02:40

    Given that "sbt console" lets you run the scala repl, why not just create a custom .scala file (say "default.scala") where to store all the imports, and then just run :load /path/to/default.scala? This would achieve what you need in a persistent way.

    0 讨论(0)
提交回复
热议问题