2014-08-28 14 views
7

Tôi vừa được nhận được lỗi sau khi cố gắng biên dịch bất kỳ ứng dụng Play:Tại sao báo cáo sbt "giá trị enablePlugins không phải là thành viên của sbt.Project" trong dự án Play?

error: value enablePlugins is not a member of sbt.Project 
lazy val root = (project in file(".")).enablePlugins(PlayScala) 
            ^
sbt.compiler.EvalException: Type error in expression 
    at sbt.compiler.Eval.checkError(Eval.scala:343) 
    at sbt.compiler.Eval.compileAndLoad(Eval.scala:165) 
    at sbt.compiler.Eval.evalCommon(Eval.scala:135) 
    at sbt.compiler.Eval.evalDefinitions(Eval.scala:109) 
    ... 
    ... 
    sbt.compiler.EvalException: Type error in expression 
Use 'last' for the full log. 
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? 
Failed to reload source file list: sbt process never got in touch, 
so unable to handle request WatchTransitiveSourcesRequest(true) 

Tôi đã nhìn thấy một số nói chuyện của lỗi này ở nơi khác nhưng không giống như trong những ví dụ tôi không có bất kỳ plugin thêm hoặc phụ thuộc dự án-Tôi nhận được lỗi này khi biên dịch mẫu play-scala không bị ảnh hưởng sau khi chọn nó với activator new.

Dưới đây là những plugin bao gồm trong mẫu trong project/plugins.sbt:

Lần cuối cùng tôi xây dựng một ứng dụng Play là khoảng một tháng trước đây và tôi đã không có vấn đề, trong khi chờ đợi tôi đã biên soạn vani Ứng dụng Scala chỉ (thường với Activator) mà không gặp bất kỳ sự cố nào. Điều này có thể liên quan đến Play-2.3 không?

Tôi có dòng sbt.version=0.13.5 trong project/build.properties và tôi đã đảm bảo phiên bản sbt của tôi là phiên bản mới nhất.

Mã của tôi là chính xác điều đó của play-scala mẫu nhưng trong trường hợp nó làm cho mọi thứ dễ dàng hơn, đây là nội dung của build.sbt:

name := """my-first-app""" 

version := "1.0-SNAPSHOT" 

lazy val root = (project in file(".")).enablePlugins(PlayScala) 

scalaVersion := "2.11.1" 

libraryDependencies ++= Seq(
    jdbc, 
    anorm, 
    cache, 
    ws 
) 

Cảm ơn trước sự giúp đỡ nào.

EDIT:

Làm sbt about từ thư mục gốc ứng dụng tôi nhận được lỗi này mà tôi sẽ bao gồm đầy đủ:

$ sbt about 
[info] Loading global plugins from /home/.sbt/0.13/plugins 
[info] Loading project definition from /home/my-first-app/project 
/home/my-first-app/build.sbt:5: error: value enablePlugins is not a member of sbt.Project 
lazy val root = (project in file(".")).enablePlugins(PlayScala) 
            ^
sbt.compiler.EvalException: Type error in expression 
    at sbt.compiler.Eval.checkError(Eval.scala:343) 
    at sbt.compiler.Eval.compileAndLoad(Eval.scala:165) 
    at sbt.compiler.Eval.evalCommon(Eval.scala:135) 
    at sbt.compiler.Eval.evalDefinitions(Eval.scala:109) 
    at sbt.EvaluateConfigurations$.evaluateDefinitions(EvaluateConfigurations.scala:197) 
    at sbt.EvaluateConfigurations$.evaluateSbtFile(EvaluateConfigurations.scala:99) 
    at sbt.Load$.sbt$Load$$loadSettingsFile$1(Load.scala:507) 
    at sbt.Load$$anonfun$sbt$Load$$memoLoadSettingsFile$1$1.apply(Load.scala:502) 
    at sbt.Load$$anonfun$sbt$Load$$memoLoadSettingsFile$1$1.apply(Load.scala:501) 
    at scala.Option.getOrElse(Option.scala:120) 
    at sbt.Load$.sbt$Load$$memoLoadSettingsFile$1(Load.scala:501) 
    at sbt.Load$$anonfun$loadSettings$1$2.apply(Load.scala:500) 
    at sbt.Load$$anonfun$loadSettings$1$2.apply(Load.scala:500) 
    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:500) 
    at sbt.Load$.sbt$Load$$expand$1(Load.scala:523) 
    at sbt.Load$.loadSettings(Load.scala:528) 
    at sbt.Load$.sbt$Load$$loadSbtFiles$1(Load.scala:464) 
    at sbt.Load$.defaultLoad$1(Load.scala:475) 
    at sbt.Load$.loadTransitive(Load.scala:478) 
    at sbt.Load$.loadProjects$1(Load.scala:418) 
    at sbt.Load$.loadUnit(Load.scala:419) 
    at sbt.Load$$anonfun$15$$anonfun$apply$11.apply(Load.scala:256) 
    at sbt.Load$$anonfun$15$$anonfun$apply$11.apply(Load.scala:256) 
    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:312) 
    at sbt.Load$.loadURI(Load.scala:264) 
    at sbt.Load$.load(Load.scala:260) 
    at sbt.Load$.load(Load.scala:251) 
    at sbt.Load$.apply(Load.scala:134) 
    at sbt.Load$.defaultLoad(Load.scala:37) 
    at sbt.BuiltinCommands$.doLoadProject(Main.scala:473) 
    at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:467) 
    at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:467) 
    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:100) 
    at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:100) 
    at sbt.State$$anon$1.process(State.scala:179) 
    at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:100) 
    at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:100) 
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18) 
    at sbt.MainLoop$.next(MainLoop.scala:100) 
    at sbt.MainLoop$.run(MainLoop.scala:93) 
    at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:71) 
    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.StandardMain$.runManaged(Main.scala:57) 
    at sbt.xMain.run(Main.scala:29) 
    at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109) 
    at xsbt.boot.Launch$.withContextLoader(Launch.scala:129) 
    at xsbt.boot.Launch$.run(Launch.scala:109) 
    at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:36) 
    at xsbt.boot.Launch$.launch(Launch.scala:117) 
    at xsbt.boot.Launch$.apply(Launch.scala:19) 
    at xsbt.boot.Boot$.runImpl(Boot.scala:44) 
    at xsbt.boot.Boot$.main(Boot.scala:20) 
    at xsbt.boot.Boot.main(Boot.scala) 
[error] sbt.compiler.EvalException: Type error in expression 
[error] Use 'last' for the full log. 
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? 

Làm nó từ bên ngoài thư mục app tôi nhận được:

$ sbt about 
[info] Loading global plugins from /home/.sbt/0.13/plugins 
[info] Set current project to/(in build file:/home/) 
[info] This is sbt 0.13.5 
[info] The current project is {file:/home/} 0.1-SNAPSHOT 
[info] The current project is built against Scala 2.10.4 
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, EnsimePlugin, com.typesafe.sbt.SbtScalariform 
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.4 
+0

Bạn có thể đưa nội dung của 'project/plugins.sbt' vào câu hỏi không? Xóa bộ nhớ cache cục bộ bằng 'sbt 'tải lại đầy đủ'' và bắt đầu lại. –

+0

Cảm ơn sự giúp đỡ của bạn, tôi đã thêm nội dung vào bài đăng. Biên dịch sau khi 'sbt 'tải lại full'' cho cùng một thông báo lỗi. – TrustyPatches

+0

Bạn cũng có thể thực hiện 'sbt about' và đưa đầu ra vào câu hỏi không? –

Trả lời

3

Sau khi nhận xét, đặc biệt. the last one by the OP, tôi tin rằng lý do có thể là một plugin được cài đặt theo số ~/.sbt/0.13/plugins gây nhầm lẫn với các bổ sung mới nhất cho sbt.Project. Đó là lý do tại sao tôi đề xuất đổi tên các thư mục đặc biệt ~/.sbt/0.13~/.sbt/0.13/plugins.

Từ Global plugins trong tài liệu chính thức của SBT:

Thư mục ~/.sbt/0.13/plugins/ được coi là một dự án định nghĩa Plugin toàn cầu. Đây là một dự án sbt bình thường có classpath là có sẵn cho tất cả các định nghĩa dự án sbt cho người dùng đó như được mô tả ở trên cho các plugin cho mỗi dự án.

Có ít nhất một trường hợp được xác nhận trong trường hợp xảy ra trong quá khứ với plugin đã làm điều đó - sbt đã tắt với plugin được bật và hoạt động tốt mà không có plugin. Xem print not accepted in task definition in SBT 0.13?. Tôi nghĩ rằng tôi đã nhìn thấy người khác, nhưng không thể tìm thấy nó ngay bây giờ để chỉ ở đây như là một tài liệu tham khảo.

0

Đối với tôi, đó là một plugin khác làm rối loạn độ phân giải của plugin. Loại bỏ nó bây giờ nó hoạt động tốt.

Các vấn đề liên quan