Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run main class in test folder?

Tags:

scala

sbt

If I have a simple object with a main method in the test folder of a project, how do I run it with sbt?

like image 955
Johan S Avatar asked Sep 20 '14 20:09

Johan S


2 Answers

sbt "test:runMain path.to.MainObjectInTest"
like image 56
Kenji Yoshida Avatar answered Oct 28 '22 17:10

Kenji Yoshida


...And if you have multiple projects in you sbt file then:

sbt "projectName/test:runMain path.to.MainObjectInTest"

or just use:

sbt "projectName/test:run"

If you have only one object with main, this will run it. If you have multiple objects with main, it will ask you to select which one to run.

like image 25
user4955663 Avatar answered Oct 28 '22 15:10

user4955663