如何在没有 sbt 的情况下运行 sbt 管理的应用程序项目? [英] How to run a sbt-managed application project without sbt?

查看:34
本文介绍了如何在没有 sbt 的情况下运行 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 to sbt 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 generates target/start. It also adds a stage task, aliased to the start-script task.

This is what Heroku uses to run Scala apps.

这篇关于如何在没有 sbt 的情况下运行 sbt 管理的应用程序项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆