2014-06-26 47 views
5

我正在嘗試在使用SBT版本0.13.5的項目中啓用自定義AutoPlugin。當我嘗試通過啓用插件,在我build.sbt爲什麼sbt會拋出「value enablePlugins不是sbt.Project的成員」異常?

val aProject = project.in(file("foo")).enablePlugins(MyAutoPlugin) 

試圖從命令行啓動SBT時,我得到了以下錯誤:

value enablePlugins is not a member of sbt.Project 
... (big stack trace) ... 
[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? 

當我看到了SBT源代碼。項目我看到enablePluginsis defined。這裏發生了什麼?

編輯:當我刪除對enablePlugins的呼叫時,我可以成功啓動SBT會話。運行> about確認SBT版本是0.13.5。

編輯3:我發現當我用「2014.06.26-1-SNAPSHOT」格式的版本發佈插件到Sonatype時,SBT無法加載上述錯誤。但是,如果我將格式更改爲在「-1」之後包含單個字母,則加載SBT。所以這個版本格式的工作原理是:「2014.06.26-1a-SNAPSHOT」。我發現這一點是因爲我發現解決本地發佈的插件似乎工作正常(除了一個從未工作的插件之外的所有插件),同時解決了發佈到Sonatype的完全相同的插件導致的錯誤。當我在本地發佈時,我總是給該版本添加一封信。

編輯2:SBT日誌的全輸出:

[info] Loading global plugins from /Users/markschaake/.sbt/0.13/plugins 
[debug] 
[debug] Initial source changes: 
[debug]  removed:Set() 
[debug]  added: Set() 
[debug]  modified: Set() 
[debug] Removed products: Set() 
[debug] External API changes: API Changes: Set() 
[debug] Modified binary dependencies: Set() 
[debug] Initial directly invalidated sources: Set() 
[debug] 
[debug] Sources indirectly invalidated by: 
[debug]  product: Set() 
[debug]  binary dep: Set() 
[debug]  external source: Set() 
[debug] All initially invalidated sources: Set() 
[debug] Copy resource mappings: 
[debug]  
[debug] Other repositories: 
[debug]  FileRepository(publish-m2-local,FileConfiguration(true,None),Patterns(ivyPatterns=List(), artifactPatterns=List(/Users/markschaake/.m2/repository/[organisation]/[module](_[scalaVersion])(_[sbtVersion])/[revision]/[artifact]-[revision](-[classifier]).[ext]), isMavenCompatible=true, descriptorOptional=false, skipConsistencyCheck=false)) 
[debug] Default repositories: 
[debug]  Raw(ProjectResolver(inter-project, mapped:)) 
[debug]  URLRepository(typesafe-ivy-releases,Patterns(ivyPatterns=List(http://repo.typesafe.com/typesafe/ivy-releases/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=List(http://repo.typesafe.com/typesafe/ivy-releases/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false)) 
[debug]  URLRepository(sbt-plugin-releases,Patterns(ivyPatterns=List(http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=List(http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false)) 
[debug]  FileRepository(local,FileConfiguration(true,None),Patterns(ivyPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false)) 
[debug]  public: http://repo1.maven.org/maven2/ 
[debug] Using inline dependencies specified in Scala. 
[debug] deducing auto plugins based on known facts Set(Atom(sbt.plugins.CorePlugin)) and clauses Clauses(List(Clause(Atom(sbt.plugins.JvmPlugin),Set(Atom(sbt.plugins.IvyPlugin))), Clause(Atom(sbt.plugins.JUnitXmlReportPlugin),Set(Atom(sbt.plugins.JvmPlugin))), Clause(Atom(sbt.plugins.CorePlugin),Set(Atom(sbt.plugins.IvyPlugin))), Clause(Atom(sbt.plugins.IvyPlugin),Set(Atom(sbt.plugins.JvmPlugin))), Clause(Atom(sbt.plugins.JvmPlugin),Set(Atom(sbt.plugins.JUnitXmlReportPlugin))))) 
[debug] :: deduced result: Matched(sbt.plugins.CorePlugin,sbt.plugins.IvyPlugin,sbt.plugins.JvmPlugin,sbt.plugins.JUnitXmlReportPlugin) 
[debug] sorting: ns: List(sbt.plugins.CorePlugin, sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.JUnitXmlReportPlugin) 
[debug] :: sorting:: found: List(sbt.plugins.CorePlugin) not found List(sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.JUnitXmlReportPlugin) 
[debug] :: sorting:: found: List(sbt.plugins.CorePlugin, sbt.plugins.IvyPlugin) not found List(sbt.plugins.JvmPlugin, sbt.plugins.JUnitXmlReportPlugin) 
[debug] :: sorting:: found: List(sbt.plugins.CorePlugin, sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin) not found List(sbt.plugins.JUnitXmlReportPlugin) 
[debug] :: sorting:: found: List(sbt.plugins.CorePlugin, sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.JUnitXmlReportPlugin) not found List() 
[debug] :: sorted deduced result: List(sbt.plugins.CorePlugin, sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.JUnitXmlReportPlugin) 
[info] Loading project definition from /Users/markschaake/ai2/git/ai2-parsers/project/project 
[debug] Running task... Cancel: [email protected], check cycles: false 
[debug] 
[debug] Initial source changes: 
[debug]  removed:Set() 
[debug]  added: Set() 
[debug]  modified: Set() 
[debug] Removed products: Set() 
[debug] External API changes: API Changes: Set() 
[debug] Modified binary dependencies: Set() 
[debug] Initial directly invalidated sources: Set() 
[debug] 
[debug] Sources indirectly invalidated by: 
[debug]  product: Set() 
[debug]  binary dep: Set() 
[debug]  external source: Set() 
[debug] All initially invalidated sources: Set() 
[debug] Copy resource mappings: 
[debug]  
[debug] deducing auto plugins based on known facts Set(Atom(sbt.plugins.CorePlugin)) and clauses Clauses(List(Clause(Atom(sbt.plugins.JvmPlugin),Set(Atom(sbt.plugins.IvyPlugin))), Clause(Atom(sbt.plugins.JUnitXmlReportPlugin),Set(Atom(sbt.plugins.JvmPlugin))), Clause(Atom(sbt.plugins.CorePlugin),Set(Atom(sbt.plugins.IvyPlugin))), Clause(Atom(sbt.plugins.IvyPlugin),Set(Atom(sbt.plugins.JvmPlugin))), Clause(Atom(sbt.plugins.JvmPlugin),Set(Atom(sbt.plugins.JUnitXmlReportPlugin))))) 
[debug] :: deduced result: Matched(sbt.plugins.CorePlugin,sbt.plugins.IvyPlugin,sbt.plugins.JvmPlugin,sbt.plugins.JUnitXmlReportPlugin) 
[debug] sorting: ns: List(sbt.plugins.CorePlugin, sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.JUnitXmlReportPlugin) 
[debug] :: sorting:: found: List(sbt.plugins.CorePlugin) not found List(sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.JUnitXmlReportPlugin) 
[debug] :: sorting:: found: List(sbt.plugins.CorePlugin, sbt.plugins.IvyPlugin) not found List(sbt.plugins.JvmPlugin, sbt.plugins.JUnitXmlReportPlugin) 
[debug] :: sorting:: found: List(sbt.plugins.CorePlugin, sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin) not found List(sbt.plugins.JUnitXmlReportPlugin) 
[debug] :: sorting:: found: List(sbt.plugins.CorePlugin, sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.JUnitXmlReportPlugin) not found List() 
[debug] :: sorted deduced result: List(sbt.plugins.CorePlugin, sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.JUnitXmlReportPlugin) 
[info] Loading project definition from /Users/markschaake/ai2/git/ai2-parsers/project 
[debug] Running task... Cancel: [email protected], check cycles: false 
[debug] 
[debug] Initial source changes: 
[debug]  removed:Set() 
[debug]  added: Set() 
[debug]  modified: Set() 
[debug] Removed products: Set() 
[debug] External API changes: API Changes: Set() 
[debug] Modified binary dependencies: Set() 
[debug] Initial directly invalidated sources: Set() 
[debug] 
[debug] Sources indirectly invalidated by: 
[debug]  product: Set() 
[debug]  binary dep: Set() 
[debug]  external source: Set() 
[debug] All initially invalidated sources: Set() 
[debug] Copy resource mappings: 
[debug]  
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) 
+0

你能添加'about'的輸出內容命令? – lpiepiora

+0

您能否提供重現此錯誤的最小工作示例? – lpiepiora

+0

您可以執行'sbt -Dsbt.global.base =/tmp/so'來刪除任何可能干擾sbt 0.13.5的全局插件嗎?你可能使用'addSbtPlugin(「net.virtual-void」%「sbt-dependency-graph」%「0.7.4」)'作爲插件嗎? [至少有一個事件報告](http:// stackoverflow。com/q/20873896/1305344),導致一些類似於你的麻煩。 –

回答

5

原來,問題曾與發佈到Sonatype的快照庫,以及如何解決SBT插件做。

我按照official SBT documentation的建議改爲發佈到Bintray。我也只發布版本(而不是快照)。現在一切正常。

更新:一個簡單的解決方法是在你的project/pugins.sbt添加一個依賴倍率爲SBT版本:

// project/plugins.sbt 
dependencyOverrides += "org.scala-sbt" % "sbt" % "0.13.7" 

注意:你所提供的版本應該是一樣什麼是你project/build.properties文件。

+0

2016年末更新:問題依然存在,解決方法標記提到仍然有效 – Azeli

0

您可以使用project/Build.scala代替build.sbt的生成配置來解決此問題。

的實際問題在sbt/#1592詳細和gatling-sbt/#29

+1

不過請注意,發佈Bintray插件對於這個問題來說是一個更好的解決方案。如果使用'.sbt',則不需要移至'.scala'構建版本+這些插件將可用於任何SBT構建項目而不依賴於額外的解析器。 –

相關問題