当我用sbt运行play框架示例时出现一些错误

时间:2014-03-22 00:40:35

标签: scala playframework sbt playframework-2.2

我的操作系统是Windows 8,我在没有激活器的情况下下载了Play框架2.2。我试图通过sbt来构建它。当我在zentask目录下时:

我运行sbt,错误是:

C:\testprojects\zentasks>sbt last
[error] java.lang.NullPointerException
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? last
java.lang.NullPointerException
    at sbt.StringUtilities$.nonEmpty(StringUtilities.scala:12)
    at sbt.impl.GroupArtifactID.$percent(DependencyBuilders.scala:50)
    at $15f60aabe1897273e9e3$.$sbtdef(C:\testprojects\zentasks\project\plugins.sbt:8)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at sbt.compiler.Eval$.getValue(Eval.scala:420)
    at sbt.compiler.Eval$$anonfun$4.apply(Eval.scala:87)
    at sbt.compiler.Eval$$anonfun$4.apply(Eval.scala:87)
    at sbt.EvaluateConfigurations$$anonfun$evaluateSetting$1.apply(EvaluateConfigurations.scala:82)
    at sbt.EvaluateConfigurations$$anonfun$evaluateSetting$1.apply(EvaluateConfigurations.scala:80)
    at sbt.EvaluateConfigurations$$anonfun$flatten$1$$anonfun$apply$5.apply(EvaluateConfigurations.scala:63)
    at sbt.EvaluateConfigurations$$anonfun$flatten$1$$anonfun$apply$5.apply(EvaluateConfigurations.scala:63)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
    at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
    at sbt.EvaluateConfigurations$$anonfun$flatten$1.apply(EvaluateConfigurations.scala:63)
    at sbt.EvaluateConfigurations$$anonfun$flatten$1.apply(EvaluateConfigurations.scala:63)
    at sbt.EvaluateConfigurations$$anonfun$evaluateSbtFile$1.apply(EvaluateConfigurations.scala:59)
    at sbt.EvaluateConfigurations$$anonfun$evaluateSbtFile$1.apply(EvaluateConfigurations.scala:59)
    at sbt.Load$.sbt$Load$$loadSettingsFile$1(Load.scala:501)
    at sbt.Load$$anonfun$sbt$Load$$memoLoadSettingsFile$1$1.apply(Load.scala:496)
    at sbt.Load$$anonfun$sbt$Load$$memoLoadSettingsFile$1$1.apply(Load.scala:495)
    at scala.Option.getOrElse(Option.scala:120)
    at sbt.Load$.sbt$Load$$memoLoadSettingsFile$1(Load.scala:495)
    at sbt.Load$$anonfun$loadSettings$1$2.apply(Load.scala:494)
    at sbt.Load$$anonfun$loadSettings$1$2.apply(Load.scala:494)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)

    at scala.collection.AbstractTraversable.map(Traversable.scala:105)
    at sbt.Load$.loadSettings$1(Load.scala:494)
    at sbt.Load$.sbt$Load$$expand$1(Load.scala:507)
    at sbt.Load$.loadSettings(Load.scala:511)
    at sbt.Load$.sbt$Load$$loadSbtFiles$1(Load.scala:465)
    at sbt.Load$.defaultLoad$1(Load.scala:471)
    at sbt.Load$.loadTransitive(Load.scala:474)
    at sbt.Load$.loadProjects$1(Load.scala:420)
    at sbt.Load$.loadUnit(Load.scala:421)
    at sbt.Load$$anonfun$15$$anonfun$apply$11.apply(Load.scala:257)
    at sbt.Load$$anonfun$15$$anonfun$apply$11.apply(Load.scala:257)
    at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfunapply$5$$anonfun$apply$6.apply(BuildLoader.scala:93)
    at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:92)
    at sbt.BuildLoader.apply(BuildLoader.scala:143)
    at sbt.Load$.loadAll(Load.scala:313)
    at sbt.Load$.loadURI(Load.scala:265)
    at sbt.Load$.load(Load.scala:261)
    at sbt.Load$.load(Load.scala:252)
    at sbt.Load$.apply(Load.scala:136)
    at sbt.Load$.buildPluginDefinition(Load.scala:593)
    at sbt.Load$.buildPlugins(Load.scala:559)
    at sbt.Load$.plugins(Load.scala:547)
    at sbt.Load$.loadUnit(Load.scala:411)
    at sbt.Load$$anonfun$15$$anonfun$apply$11.apply(Load.scala:257)
    at sbt.Load$$anonfun$15$$anonfun$apply$11.apply(Load.scala:257)
    at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:93)
    at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:92)
    at sbt.BuildLoader.apply(BuildLoader.scala:143)
    at sbt.Load$.loadAll(Load.scala:313)
    at sbt.Load$.loadURI(Load.scala:265)
    at sbt.Load$.load(Load.scala:261)
    at sbt.Load$.load(Load.scala:252)
    at sbt.Load$.apply(Load.scala:136)
    at sbt.Load$.defaultLoad(Load.scala:40)
    at sbt.BuiltinCommands$.doLoadProject(Main.scala:434)
    at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:428)
    at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:428)
    at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
    at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
    at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
    at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
    at sbt.Command$.process(Command.scala:95)
    at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:87)
    at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:87)
    at sbt.State$$anon$1.process(State.scala:176)
    at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:87)
    at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:87)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.MainLoop$.next(MainLoop.scala:87)
    at sbt.MainLoop$.run(MainLoop.scala:80)
    at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:69)
    at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:66)
    at sbt.Using.apply(Using.scala:25)
    at sbt.MainLoop$.runWithNewLog(MainLoop.scala:66)
    at sbt.MainLoop$.runAndClearLast(MainLoop.scala:49)
    at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:33)
    at sbt.MainLoop$.runLogged(MainLoop.scala:25)
    at sbt.xMain.run(Main.scala:26)
    at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
    at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
    at xsbt.boot.Launch$.run(Launch.scala:57)
    at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
    at xsbt.boot.Launch$.launch(Launch.scala:65)
    at xsbt.boot.Launch$.apply(Launch.scala:16)
    at xsbt.boot.Boot$.runImpl(Boot.scala:32)
    at xsbt.boot.Boot$.main(Boot.scala:21)
    at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.NullPointerException

我配置了正确的JAVA_HOME和PATH。但仍有错误。

2 个答案:

答案 0 :(得分:0)

Play框架使用自定义键和任务扩展了SBT,因此无法使用sbt加载Play项目。确保play.bat位于PATH,并在zentasks目录中运行play

答案 1 :(得分:0)

@Julien Lafont说我应该特别推荐System.getProperty(“play.version”)

“play.version”应该是专门的,然后示例可以成功运行。