0

Is there any way to run sbt commands with only a jar instead of a project?

I've been having issues using scopt with java or scala commands, and it only seems to work with sbt.

Ideally something like

sbt --jar <jar name>/"run-main <options"
Daniel Imberman
  • 618
  • 1
  • 5
  • 18
  • Perhaps you may want to share the issues you're having with scopt, using the java command is more portable and you may want to consider it. – stefanobaghino Oct 04 '16 at 21:57
  • I don't think you need SBT to do that. You can just use java. See [here](http://stackoverflow.com/a/6780789/1553233) for an example. – marios Oct 04 '16 at 23:50

1 Answers1

0

You'd probably want to package everything up into something you can execute. One possibility would be to create a fat jar using something like sbt-assembly.

Once you've built your jar, you can then:

java -jar /path/to.jar --your-options

Take note that at this point you can only do what would have been the equivalent of sbt run-main with the jar. You cannot of course invoke any of the other sbt commands on the jar created.

jvliwanag
  • 1,508
  • 1
  • 13
  • 29