我最近在scala中启动了一个android项目,我是一个emacs书呆子,我想在emacs而不是IntelliJ中使用ensime。根据安装说明和本帖:
我的〜/ .sbt / plugins / plugins.sbt看起来像这样:
resolvers += "Sonatype releases" at "https://oss.sonatype.org/content/repositories/snapshots"
addSbtPlugin("org.ensime" % "ensime-sbt-cmd" % "0.1.2")
我项目的项目/ plugins.sbt如下所示:
addSbtPlugin("org.scala-sbt" % "sbt-android" % "0.7.1-SNAPSHOT")
(虽然我认为这不相关)。
当我运行sbt时,输出如下所示:
[info] Loading global plugins from /Users/jmiles/.sbt/plugins
[info] Updating {file:/Users/jmiles/.sbt/plugins/}default-bdeac8...
[info] Resolving org.ensime#ensime-sbt-cmd;0.1.2 ...
[warn] module not found: org.ensime#ensime-sbt-cmd;0.1.2
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.ensime/ensime-sbt-cmd/scala_2.9.2/sbt_0.12/0.1.2/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/org.ensime/ensime-sbt-cmd/scala_2.9.2/sbt_0.12/0.1.2/ivys/ivy.xml
[warn] ==== local: tried
[warn] /Users/jmiles/.ivy2/local/org.ensime/ensime-sbt-cmd/scala_2.9.2/sbt_0.12/0.1.2/ivys/ivy.xml
[warn] ==== Sonatype releases: tried
[warn] https://oss.sonatype.org/content/repositories/snapshots/org/ensime/ensime-sbt-cmd_2.9.2_0.12/0.1.2/ensime-sbt-cmd-0.1.2.pom
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/ensime/ensime-sbt-cmd_2.9.2_0.12/0.1.2/ensime-sbt-cmd-0.1.2.pom
[info] Resolving org.scala-sbt#precompiled-2_10_0-m7;0.12.1 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.ensime#ensime-sbt-cmd;0.1.2: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] org.ensime:ensime-sbt-cmd:0.1.2 (sbtVersion=0.12, scalaVersion=2.9.2)
[warn]
sbt.ResolveException: unresolved dependency: org.ensime#ensime-sbt-cmd;0.1.2: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:214)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:121)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:114)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:114)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:102)
at sbt.IvySbt.liftedTree1$1(Ivy.scala:49)
(etc.)
任何帮助?
答案 0 :(得分:1)
我一直都有依赖关系。虽然我没有解释,但这里是反复出现的常见模式。
通常,插件/库开发人员提供的代码是错误的。当我访问他们的maven存储库时,他们列出的版本在存储库中不存在。我只是将它更新到正确的版本,然后繁荣它的工作原理。此外,由于某些原因,当我把它们放在plugins.sbt(建议的地方)时,一些插件工作。其他人只有在我将它们粘贴在project / build.sbt中时才有效。它没有意义,但是一旦我移动它就会突然安装并运行。合并依赖列表。如果你在一起黑客攻击并在build.scala和build.sbt中都有一个依赖项,那么它将抛出一个完全无用的泛型错误。删除其中一个,然后突然运行。
另请注意,%会导致将scala版本附加到其名称。而%%明确定义名称。有时这会在使用%时导致错误,因为它没有可用于该scala版本的版本。转到存储库并显式输入包的名称以解决此问题。
答案 1 :(得分:1)
ensime 0.1.2仅适用于sbt版本0.13.x.如果这是一个新项目,您可以考虑使用当前版本的sbt。通常,您可以通过创建包含project/build.properties
sbt.version=0.13.0
来执行此操作