开发者

Packaging and Deploying Scala Applications

开发者 https://www.devze.com 2023-01-03 09:20 出处:网络
What is the simplest way to package a Scala application for use on a desktop PC? I\'m guessing that would be in the form of a jar file.

What is the simplest way to package a Scala application for use on a desktop PC? I'm guessing that would be in the form of a jar file.

At the moment I'm 开发者_如何转开发using SBT to compile and run programs

I'd be interested in solutions for machines that have Scala installed (and the library in their classpath), as well as those that only have Java.


The simplest (and the most consistent) way to package a Scala application, is packaging into a JAR (like you do with normal Java applications). As long as JAR consists of standard compiled Java classes, you may run "Scala" JAR, even if you don't have Scala runtime at the box (all you need is a Java Runtime and scala-lang.jar on the classpath). You may specify the main class (gateway to functionalities of your application) in the manifast

Main-Class: mypackage.MyClass

so that you'll be able to call it only passing a JAR name to java.exe.

java -jar myjar.jar

You may specify the main class in SBT project definition.


http://www.scala-sbt.org/sbt-native-packager/index.html

The plugin allows you to package in a variety of formats(zip, tar, deb, dmg, msi, etc) and in different archtypes.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号