2014-06-26 6 views
5

मैं एसबीटी संस्करण 0.13.5 का उपयोग कर एक प्रोजेक्ट में एक कस्टम ऑटोप्लगिन सक्षम करने की कोशिश कर रहा हूं।एसबीटी फेंक क्यों देता है "मूल्य सक्षम प्लगइन एसबीटी.प्रोजेक्ट का सदस्य नहीं है" अपवाद?

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

जब कमांड लाइन से एसबीटी शुरू करने की कोशिश मैं निम्नलिखित त्रुटि मिलती है:: जब मैं के माध्यम से मेरी build.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? 

जब मैं एसबीटी के लिए स्रोत कोड को देखो प्रोजेक्ट मैं देखता हूं कि enablePluginsis defined। यहाँ क्या हो रहा है?

संपादित करें: जब मैं enablePlugins पर कॉल हटा देता हूं तो मैं सफलतापूर्वक एक एसबीटी सत्र शुरू कर सकता हूं। चल रहा है > about पुष्टि करता है कि एसबीटी संस्करण 0.13.5 है।

संपादित 3: मैंने पाया कि जब मैं "2014.06.26-1-स्नैपशॉट" कि एसबीटी ऊपर त्रुटि के साथ लोड करने के लिए विफल रहता है के प्रारूप में एक संस्करण के साथ Sonatype को प्लग-इन को प्रकाशित करें। हालांकि, अगर मैं प्रारूप को "-1" के बाद एक अक्षर शामिल करने के लिए बदलता हूं, तो एसबीटी लोड होता है। तो यह संस्करण प्रारूप काम करता है: "2014.06.26-1a-SNAPSHOT"। मैंने यह खोज लिया क्योंकि मुझे स्थानीय रूप से प्रकाशित प्लगइन्स को हल करने का पता चला ठीक लग रहा था (सभी के लिए एक प्लगइन जो कभी काम नहीं करता), सोनाटाइप को प्रकाशित सटीक उसी प्लगइन को हल करने में त्रुटि हुई। जब मैंने स्थानीय रूप से प्रकाशित किया, तो मैंने हमेशा संस्करण में एक पत्र जोड़ा।

संपादित 2: एसबीटी लॉग का पूरा उत्पादन:

[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' निष्पादित कर सकते हैं जो एसबीटी 0.13.5 में हस्तक्षेप कर सकता है? क्या आप शायद प्लगइन के रूप में 'addSbtPlugin ("net.virtual-void"% "sbt-निर्भरता-ग्राफ"% "0.7.4") का उपयोग करते हैं? [कम से कम एक घटना की सूचना दी गई है] (http: // stackoverflow।कॉम/क्यू/208738 9 6/1305344) जिसने आपके जैसी कुछ परेशानी पैदा की। –

उत्तर

5

बाहर कर देता है समस्या Sonatype स्नैपशॉट भंडार करने के लिए प्रकाशन और कैसे एसबीटी प्लगइन्स का समाधान से कोई लेना देना नहीं था।

मैंने official SBT documentation से इसके बजाय Bintray को प्रकाशित करने के लिए अनुशंसा का पालन किया। मैं केवल रिलीज प्रकाशित कर रहा हूं (और स्नैपशॉट नहीं)। अब सब कुछ ठीक काम करता है।

अद्यतन: एक सरल समाधान का अपने project/pugins.sbt में एसबीटी संस्करण के लिए एक निर्भरता ओवरराइड जोड़ने के लिए है:

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

नोट: संस्करण उपलब्ध कराने क्या आपके project/build.properties फ़ाइल में है के रूप में ही होना चाहिए।

+0

देर से अपडेट अपडेट 2016: समस्या अभी भी मौजूद है और वर्कअराउंड मार्क अभी भी मान्य है – Azeli

0

build.sbt के बजाय आप अपनी बिल्ड कॉन्फ़िगरेशन के लिए project/Build.scala का उपयोग करके इस समस्या को हल कर सकते हैं।

वास्तविक मुद्दा sbt/#1592 में विस्तृत है और gatling-sbt/#29

+1

हालांकि, कृपया ध्यान दें कि बिंटरे को प्रकाशित प्लगइन उस मुद्दे के लिए एक बेहतर समाधान है। यदि आपने '.sbt' + का उपयोग किया है तो आपको 'एसएसटीए' बिल्ड में जाने की आवश्यकता नहीं है, वे प्लगइन अतिरिक्त रिज़ॉल्यूशन पर भरोसा किए बिना किसी भी एसबीटी बिल्ड प्रोजेक्ट के लिए उपलब्ध होंगे। –

संबंधित मुद्दे