如何在没有 sbt 的情况下运行 sbt 管理的应用程序项目? [英] How to run a sbt-managed application project without sbt?
问题描述
我的问题是关于运行一个由 sbt 0.10.1
管理的项目中的应用程序,因此依赖于它的自动依赖管理(下载并设置适当的类路径来运行).
使用自动依赖管理时,似乎运行应用程序的唯一方法是使用 sbt 本身,因为它知道如何设置类路径(在 Ivy2 的帮助下).>
如何在没有 sbt 的情况下运行应用程序?
您也可以使用 Typesafe 的 xsbt-start-script-plugin(现在 sbt-start-script) 以生成具有正确类路径的 shell 脚本:
这个插件允许你生成一个脚本 target/start
项目.该脚本将就地"运行项目(无需先构建一个包).
target/start
脚本类似于 sbt run
但它不依赖在 SBT 上.sbt run
不推荐用于生产环境,因为它将 SBT 本身保存在内存中.target/start
旨在运行生产中的应用.
插件添加了一个任务start-script
,它生成target/start
.它还添加了一个 stage
任务,别名为 start-script
任务.
这就是 Heroku 使用运行 Scala 应用程序的方式.
My question is about running an application that's in a project managed by sbt 0.10.1
and hence relies on its automatic dependency management (to download and set up appropriate classpath to run).
When using the automatic dependency management, it appears that the only way to run the application is using sbt itself because it knows how to set up the classpath (with a help of Ivy2).
How can I run the application without sbt?
You can also use Typesafe's xsbt-start-script-plugin (edit: now sbt-start-script) to generate a shell script with the correct class path:
This plugin allows you to generate a script
target/start
for a project. The script will run the project "in-place" (without having to build a package first).The
target/start
script is similar tosbt run
but it doesn't rely on SBT.sbt run
is not recommended for production use because it keeps SBT itself in-memory.target/start
is intended to run an app in production.The plugin adds a task
start-script
which generatestarget/start
. It also adds astage
task, aliased to thestart-script
task.
This is what Heroku uses to run Scala apps.
这篇关于如何在没有 sbt 的情况下运行 sbt 管理的应用程序项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!