sbt Web插件:无效密钥:jetty-run(类似:jetty-port,jetty-context,run) [英] sbt web plugin: Not a valid key: jetty-run (similar: jetty-port, jetty-context, run)
问题描述
我正在尝试使用Lift Web框架建立一个scala sbt项目.我正在使用
I'm trying to set up a scala sbt project with the lift web framework. I'm using
- 斯卡拉2.9.0-1
- sbt 0.10.1
- 电梯2.3
- xsbt-web-plugin 0.1.1(仅在scala 2.8.1上,请参阅问题结尾)
(我知道很多最新版本). 我关注了 http://d.hatena.ne.jp/k4200/20110711/1310354698和 https://github.com/siasia/xsbt- web-plugin/blob/master/README.md 获取以下sbt配置文件:
(quite recent versions I know). I followed http://d.hatena.ne.jp/k4200/20110711/1310354698 and https://github.com/siasia/xsbt-web-plugin/blob/master/README.md to obtain the following sbt configuration files:
project/build.properties
project/build.properties
sbt.version=0.10.1
project/plugins/build.sbt
project/plugins/build.sbt
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"
libraryDependencies <+= sbtVersion(v => "com.github.siasia" % "xsbt-web-plugin_2.8.1" % ("0.1.1-"+v))
project/Build.scala
project/Build.scala
import sbt._
import Keys._
object BuildSettings {
val buildOrganization = "xbaz"
val buildScalaVersion = "2.9.0-1"
val buildVersion = "0.0.1"
val buildSettings = Defaults.defaultSettings ++ Seq (
organization := buildOrganization,
scalaVersion := buildScalaVersion,
version := buildVersion)
}
object Resolvers {
val webPluginRepo = "Web plugin repo" at "http://siasia.github.com/maven2"
val jettyRepo = "Jetty Repo" at "http://repo1.maven.org/maven2/org/mortbay/jetty"
}
object Dependencies {
// web plugin
val webPluginDeps = Seq(
"org.mortbay.jetty" % "jetty" % "6.1.26" % "jetty", // The last part is "jetty" not "test".
"javax.servlet" % "servlet-api" % "2.5" % "provided->default"
)
val liftDeps = {
val liftVersion = "2.3" // I'll switch to 2.3 soon!
Seq(
"net.liftweb" % "lift-webkit_2.8.1" % liftVersion % "compile->default",
"net.liftweb" % "lift-mapper_2.8.1" % liftVersion % "compile->default"
)
}
val scalaTest = "org.scalatest" % "scalatest_2.9.0" % "1.6.1" % "test"
val apacheHttpClient = "org.apache.httpcomponents" % "httpclient" % "4.1.1"
val apacheHttpCore = "org.apache.httpcomponents" % "httpcore" % "4.1.1"
// Logging
lazy val grizzled = "org.clapper" % "grizzled-slf4j_2.8.1" % "0.5"
lazy val junit = "junit" % "junit" % "4.8" % "test"
lazy val logback_core = "ch.qos.logback" % "logback-core" % "0.9.24" % "compile" //LGPL 2.1
lazy val logback_classic = "ch.qos.logback" % "logback-classic" % "0.9.24" % "compile" //LGPL 2.1
lazy val log4j_over_slf4j = "org.slf4j" % "log4j-over-slf4j" % "1.6.1"
val logDeps = Seq(grizzled, log4j_over_slf4j, logback_core, logback_classic)
}
object MyBuild extends Build {
import com.github.siasia.WebPlugin._ // web plugin
import BuildSettings._
import Dependencies._
import Resolvers._
//End dependencies
lazy val root = Project("root", file(".") , settings = buildSettings ++
Seq( name := "foo")
) aggregate(core, cli, web)
// mainClass:= Some("Main"))
lazy val core : Project = Project("core", file("core"), delegates = root :: Nil, settings = buildSettings ++
Seq(
name := "foo-core",
libraryDependencies ++= logDeps ++ Seq(scalaTest, apacheHttpClient, apacheHttpCore)
)
)
lazy val cli: Project = Project("cli", file("cli"), settings = buildSettings ++
Seq(
name := "foo-cli",
libraryDependencies ++= logDeps ++ Seq(apacheHttpClient),
fork in run := true,
javaOptions in run += "-Djava.library.path=/home/jolivier/Projets/asknow/lib/jnotify-lib-0.93"
)) dependsOn(core) settings(
)
lazy val web: Project = Project("web", file("web"), settings = buildSettings ++
Seq (resolvers := Seq(webPluginRepo, jettyRepo),
name := "foo-http",
libraryDependencies ++= logDeps ++ webPluginDeps ++ liftDeps
) ++
webSettings
) dependsOn(core)
}
当我尝试sbt jetty-run时,出现以下错误消息:
When I try sbt jetty-run I get the following error message:
[error] Not a valid command: jetty-run
[error] Not a valid project ID: jetty-run
[error] Not a valid configuration: jetty-run
[error] Not a valid key: jetty-run (similar: jetty-port, jetty-context, run)
[error] jetty-run
[error]
因此,我注意到确实存在一些jetty- *命令,但我不想要该命令,因此我打印了webSettings,该命令应该包含所有这些新设置,并且包含jetty-context和jetty-port以及jetty配置和其他配置,但不是码头运行的:s.
So I noticed that some jetty-* commands do exist, but not the one I want, so I printed webSettings which is supposed to contain all these new settings and it contains jetty-context and jetty-port, as well as jetty-configuration and others, but not jetty-run :s.
没有跳船,我怎么了?
我尝试切换到scala-2.8.1,因为该Web插件当前仅在scala 2.8.1上,方法是更改我的buildScalaVersion变量,但这没有任何改变.你有什么主意吗?
I tried switching to scala-2.8.1 since the web plugin is currently only on scala 2.8.1, by changing my buildScalaVersion variable but that didn't change anything. Do you have any idea?
预先感谢您的帮助
推荐答案
任务已汇总;命令不是.
Tasks are aggregated; commands are not.
jetty-run
是命令.仅在具有Web插件设置的子项目的上下文中可用.
jetty-run
is a command. It is only available in the context of the sub-project with the web plugin settings.
> project web
> jetty-run
运行后,您可以使用prepare-webapp
任务重新部署Web应用程序.这可以从root
项目的上下文中运行,因为它聚合了Web项目.
Once it is running, you can use the prepare-webapp
task to redeploy the webapp. This can be run from the context of the root
project, because it aggregates the web project.
这篇关于sbt Web插件:无效密钥:jetty-run(类似:jetty-port,jetty-context,run)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!