how to set main class in SBT 0.13 project

后端 未结 9 709
旧时难觅i
旧时难觅i 2020-12-23 18:58

Could you guys please explain to me how to set main class in SBT project ? I\'m trying to use version 0.13.

My directory structure is very simple (unlike SBT\'s docu

9条回答
  •  旧巷少年郎
    2020-12-23 19:13

    There are 4 options

    1. you have 1 main class

      • sbt run and sbt will find main for you
    2. you have 2 or more main classes

      • sbt run and sbt will propose to select which one you want to run.

    Multiple main classes detected, select one to run:
    [1] a.b.DummyMain1
    [2] a.b.DummyMain2
    Enter number:
    

    1. You want to set main class manually.

      mainClass in run := Some("a.b.DummyMain1")
      
    2. You could run with main class as parameter

      sbt runMain a.b.DummyMain1
      

提交回复
热议问题