Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 如何将汇编插件添加到SBT构建?_Scala_Sbt_Sbt Assembly - Fatal编程技术网

Scala 如何将汇编插件添加到SBT构建?

Scala 如何将汇编插件添加到SBT构建?,scala,sbt,sbt-assembly,Scala,Sbt,Sbt Assembly,我正在尝试使用sbt汇编插件来编译我的scala代码。当我将其打包到snapshot.jar中时,它运行良好。但当我尝试添加汇编插件并将其编译到assembly.jar时,我遇到了问题。有人能帮我吗 tong@tong-VirtualBox:/usr/local/jars/hello/hello$ sbt package [info] Set current project to hello (in build file:/usr/local/jars/hello/hello/) [info]

我正在尝试使用sbt汇编插件来编译我的scala代码。当我将其打包到snapshot.jar中时,它运行良好。但当我尝试添加汇编插件并将其编译到assembly.jar时,我遇到了问题。有人能帮我吗

tong@tong-VirtualBox:/usr/local/jars/hello/hello$ sbt package
[info] Set current project to hello (in build file:/usr/local/jars/hello/hello/)
[info] Packaging /usr/local/jars/hello/hello/target/scala-2.10/hello_2.10-0.1-SNAPSHOT.jar ...
[info] Done packaging.
[success] Total time: 1 s, completed Oct 23, 2015 10:02:52 AM
使用
sbt组件

tong@tong-VirtualBox:/usr/local/jars/hello/hello$ addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0")
bash: syntax error near unexpected token `"com.eed3si9n"'

命令
addSbtPlugin
不是unix命令,不能在Linuxshell中运行。一般来说,它是一个SBT命令(或任务,目前还不确定),只能在SBT中使用。(要进行尝试,只需从shell/bash运行
SBT
即可进入SBT控制台

因此,在您的案例中,
addSbtPlugin….
需要放在一个“.sbt”文件中,首选位置是“plugin.sbt”,在您的项目中,将插件添加到您的构建环境中。敬请参考

总的来说

在项目页面上,有一个关于如何安装/使用插件的相当清晰和简单的解释

为了加快进度,只需将以下代码片段添加到
$PROJECT\u ROOT/PROJECT/assembly.sbt

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.0")
然后从外壳开始组装阶段,如下所示:

$ cd $PROJECT_ROOT
$ sbt assembly
为了避免依赖性问题(如sbt程序集项目页面中所述),最好使用sbt版本>=0.13.6。您可以通过在
$project\u ROOT/build.properties
中放置以下内容来强制执行此操作:

sbt.version=0.13.8