Configuring sbt project to include external Main methods in “sbt run”

▼魔方 西西 提交于 2019-12-23 20:34:11

问题


It's very common for me to create an sbt project that depends on an external jar and is intended to be run with a Main method from the external jar. At the moment, I just run it using "run-main xxx" but I'd much prefer to be able to include the Main method in the list of run() options provided by sbt. Is there an easy way to do this? Or is the best option to include an sbt task that serves as an alias for run-main xxx?


回答1:


The list of main classes is collected in discoveredMainClasses and you can transform that to add your own explicitly:

discoveredMainClasses in Compile += "org.example.Main"


来源:https://stackoverflow.com/questions/16966717/configuring-sbt-project-to-include-external-main-methods-in-sbt-run

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!