为什么“sbt stage”失败并且没有有效的命令?

时间:2014-10-23 18:57:15

标签: sbt sbt-native-packager

当我尝试使用sbt clean compile stage暂存我的应用程序时出现错误:

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

我已经在其他机器上完成了数百次而没有任何问题。我有SBT 0.13.5 - 有没有人见过这个?我看过this other post,但我不在Heroku上。感谢。

2 个答案:

答案 0 :(得分:13)

the comments above之后我意识到您只想拥有stage命令,而不会将整个Play foo 带入。

stage命令是sbt-native-packager的一部分:

  

插件的目标是能够捆绑使用SBT构建的Scala软件,用于本机打包系统,如deb,rpm,homebrew,msi。

sbt-native-packager插件的一个功能是the stage command

> help stage
Create a local directory with all the files laid out as they would be in the final distribution.

只需将以下内容添加到project/plugins.sbt即可在项目中使用该插件(在the comment of Muki示例后使用带有自动插件功能的the latest version 1.0.0-M1):

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0-M1")

您还必须将以下内容添加到build.sbt

enablePlugins(JavaAppPackaging)

就是这样!你们现在都准备好了。

执行stage

> stage
[info] Packaging /Users/jacek/dev/sandbox/command-build-scala/target/scala-2.10/command-build-scala_2.10-0.1-SNAPSHOT-sources.jar ...
[info] Done packaging.
[info] Updating {file:/Users/jacek/dev/sandbox/command-build-scala/}command-build-scala...
[info] Wrote /Users/jacek/dev/sandbox/command-build-scala/target/scala-2.10/command-build-scala_2.10-0.1-SNAPSHOT.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Packaging /Users/jacek/dev/sandbox/command-build-scala/target/scala-2.10/command-build-scala_2.10-0.1-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] Packaging /Users/jacek/dev/sandbox/command-build-scala/target/scala-2.10/command-build-scala_2.10-0.1-SNAPSHOT.jar ...
[info] Done packaging.
[success] Total time: 0 s, completed Nov 5, 2014 2:55:55 PM

答案 1 :(得分:0)

经过大量的挖掘,我发现了阶段'由Play framework中的插件实现,我在其他项目中使用该插件并解释了为什么sbt正在接受stage命令。