如何在交互模式下将 sbt 多个命令作为一个命令运行? [英] How to run sbt multiple command in interactive mode as one command?

查看:34
本文介绍了如何在交互模式下将 sbt 多个命令作为一个命令运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过将两步合二为一来改进 sbt 组装/打包操作.两步是:

I want to refine sbt assembly/package operation by combine two step to one. The two step is:

$ sbt
> project XXX
....
> assembly
Ctrl + c to exit

此外,assembly 是一个任务表单fat jar sbt 插件.
我尝试使用 sbt 项目分析程序集,但没有成功.遇到错误:

Besides, assembly is a task form fat jar sbt plugin.
I have attempt with sbt project analysis assembly but not works.A error encounter:

[error] Not a valid command: analysis (similar: alias)
[error] Not a valid key: analysis (similar: readAnalysis, mainClass, less)
[error] analysis
[error]         ^

如何实现?谢谢

推荐答案

在 sbt shell 中,使用 ; 来链接命令:

Within the sbt shell, use ; to chain commands:

;project XXX; assembly

从命令行调用,用引号将单个命令括起来:

Calling from the command line, enclose individual commands with quotes:

sbt "project XXX" assembly

或用引号将整个链括起来:

or enclose a whole chain in quotes:

sbt ";project XXX; assembly"

从 shell 中另一个项目的上下文调用子项目 XXX 中的任务:

To call a task in subproject XXX from the context of another project in the shell:

XXX/assembly

这篇关于如何在交互模式下将 sbt 多个命令作为一个命令运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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