找不到 sbt 程序集命令 [英] sbt assembly command not found

查看:46
本文介绍了找不到 sbt 程序集命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行 sbt 程序集.根据 https://github.com/sbt/sbt-assembly ,对于 sbt 0.13.6+(我是在 0.13.7 上)这应该自动包含在 JvmPlugin 中.根据 sbt plugins 我在 root 中启用了 JvmPlugin.当我运行 sbt assembly 时,我得到不是有效的命令:程序集".我已经尝试使用旧方法将 sbt-assembly 包含在所有不同类型的 sbt 配置中,但似乎都不起作用.这是我的构建文件的样子(注意 sbt 包工作正常)

I'm trying to run sbt assembly. According to https://github.com/sbt/sbt-assembly , for sbt 0.13.6+ (I'm on 0.13.7) this should be included automatically for anything with the JvmPlugin. According to sbt plugins I have the JvmPlugin enabled in root. When I run sbt assembly I get "Not a valid commamdn: assembly". I've tried using old methods of including sbt-assembly with all the different types of sbt configurations, but none seem to work. Here's what my build files look like (note sbt package works fine)

程序集.sbt

addSbtPlugin("com.eed3si8n" % "sbt-assembly" % "0.13.0")

build.sbt

lazy val commonSettings = Seq(
  organization := "com.test",
  version := "1.0",
  scalaVersion := "2.10.4"
)

lazy val root = (project in file(".")).
  settings(commonSettings: _*).
  settings(
    name := "test",

    resolvers ++= Seq(
      ...
    ),

    libraryDependencies ++= Seq(
      ...
    )
)

这里是错误:

[error] Not a valid command: assembly
[error] Not a valid project ID: assembly
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: assembly
[error] assembly
[error]     

有什么想法吗?在 Linux 上运行.谢谢

Any ideas? Running on Linux. Thanks

推荐答案

您是否在项目的根目录下创建了 assembly.sbt?与您的 build.sbt 一起?

Did you create a assembly.sbt at the root of your project? Alongside your build.sbt?

如果是这样,那就是问题所在.您希望将它放在 project 目录中.

If so, then that's the problem. You want to have it inside the project directory.

完成后,它在其余设置中按预期工作:

Having done that it worked out the box as expected with the rest of your setup:

> assembly
[info] Including: scala-library.jar
[info] Checking every *.class/*.jar file's SHA-1.
[info] Merging files...
[warn] Merging 'META-INF/MANIFEST.MF' with strategy 'discard'
[warn] Strategy 'discard' was applied to a file
[info] SHA-1: 1ae0d7a9c433e439e81ce947659bf05aa62a2892
[info] Packaging /Users/dnw/Desktop/t-2015-04-08.2340/target/scala-2.10/test-assembly-1.0.jar ...
[info] Done packaging.
[success] Total time: 2 s, completed 08-Apr-2015 23:45:59

这篇关于找不到 sbt 程序集命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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