gpt4 book ai didi

scala - 为什么 sbt 程序集失败并显示 "Not a valid command: assembly"?

转载 作者:行者123 更新时间:2023-12-01 08:46:04 27 4
gpt4 key购买 nike

我将 Spark 安装到 C:\Spark1_6\spark-1.6.0-bin-hadoop2.6 .导航到此路径后,我输入 sbt assembly命令,我收到以下错误消息:

[error] Not a valid command: assembly
[error] Not a valid project ID: assembly
[error] Expected ':'
[error] Not a valid key: assembly
[error] assembly
[error] ^

这是我的 sbt 项目结构。
-Project101
-project
-build.properties
-plugins.sbt
-src
-build.sbt

这是我的 build.sbt :
name := "Project101"
version := "1.0"
scalaVersion := "2.10.2"
libraryDependencies ++= Seq(
"org.apache.spark" % "spark-core_2.10" % "1.6.0" exclude ("org.apache.hadoop","hadoop-yarn-server-web-proxy"),
"org.apache.spark" % "spark-sql_2.10" % "1.6.0" exclude ("org.apache.hadoop","hadoop-yarn-server-web-proxy"),
"org.apache.spark" %% "spark-hive" % "1.6.0",
"org.apache.spark" %% "spark-streaming" % "1.6.0",
"org.apache.spark" %% "spark-streaming-kafka" % "1.6.0"
)
resolvers in Global ++= Seq(
"Sbt plugins" at "https://dl.bintray.com/sbt/sbt-plugin-releases",
"Maven Central Server" at "http://repo1.maven.org/maven2",
"TypeSafe Repository Releases" at "http://repo.typesafe.com/typesafe/releases/",
"TypeSafe Repository Snapshots" at "http://repo.typesafe.com/typesafe/snapshots/"
)

这是 plugins.sbt :
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.12.0")
sbt package命令正在运行并且能够创建 jar 文件。但我必须执行 sbt assembly命令也是,但不起作用。

最佳答案

Not a valid command: assembly



每当您遇到错误消息时,请确保您位于项目的顶级目录中,并带有 sbt-assembly插件安装。

如果您在 Project101 有项目目录,请确保 project/plugins.sbt有一行:
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.12.0")

有了这个,你应该再次进入 Project101目录并执行 sbt assembly .那应该执行插件来创建一个 uber-jar。

关于scala - 为什么 sbt 程序集失败并显示 "Not a valid command: assembly"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44106182/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com