我正在构建一个sbt插件,并希望在sbt-assembly插件中引用汇编任务(取决于我的任务)
要做到这一点,我需要将它作为一个库(而不是插件)引用,并且不知何故sbt无法将其解析为libraryDepdendencies
这就是我的sbt看起来像
sbtPlugin := true
name := "my-sbt-plugin"
scalaVersion := "2.10.6"
sbtVersion := "0.13.0"
resolvers ++= Seq(Resolver.sbtPluginRepo("releases"), Resolver.sbtPluginRepo("snapshots"))
libraryDependencies ++= Seq(
"com.eed3si9n" % "sbt-assembly" % "0.13.0")
输出看起来像
Resolving com.eed3si9n#sbt-assembly;0.13.0 ...
[warn] module not found: com.eed3si9n#sbt-assembly;0.13.0
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== local: tried
[warn] /Users/myuser/.ivy2/local/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/eed3si9n/sbt-assembly/0.13.0/sbt-assembly-0.13.0.pom
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== sbt-plugin-snapshots: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.eed3si9n#sbt-assembly;0.13.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
答案 0 :(得分:7)
它没有解析,因为您没有指定scala版本。它应该是这样的:
libraryDependencies ++= Seq(
"com.eed3si9n" % "sbt-assembly_2.11" % "0.13.0"
)
或者,自动获取项目中使用的scala版本:
libraryDependencies ++= Seq(
// notice the double %% here
"com.eed3si9n" %% "sbt-assembly" % "0.13.0"
)
但是,sbt-assembly不应该以这种方式安装。 docs show您必须将以下行添加到project/plugins.sbt
:
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.2")
如果开发sbt插件,addSbtPlugin
行必须直接进入./build.sbt
。
答案 1 :(得分:5)
在我的情况下,将sbt汇编版本从 14.3更正为14.5 就可以了。请检查你的是什么,并尝试。
所以在 project \ assembly.sbt 中,它就像 -
addSbtPlugin(“com.eed3si9n”%“sbt-assembly”%“0.14.3”)
然后我将其改为 -
addSbtPlugin(“com.eed3si9n”%“sbt-assembly”%“0.14.5”)
希望它有所帮助!
答案 2 :(得分:1)
除了上述建议,我还要添加
resolvers += Resolver.url("bintray-sbt-plugins", url("http://dl.bintray.com/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
到project / plugins.sbt。
答案 3 :(得分:1)
它不能解决Scala - 2.12。
在 - project/plugins.sbt
-
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
resolvers += Resolver.url("bintray-sbt-plugins", url("http://dl.bintray.com/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
要找到正确的路径,请尝试以下操作 -
https://dl.bintray.com/sbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_<version>/
因此,使用版本2.12,可解析的路径可以在下面找到 -
https://dl.bintray.com/sbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.5/ivys/
答案 4 :(得分:1)
我有同样的问题,我所做的只是删除==&gt;
addSbtPlugin(&#34; com.eed3si9n&#34; %%&#34; sbt-assembly&#34;%&#34; 0.14.5&#34;)
从build.sbt行并复制到另一个文件,在同一项目级别命名为assembly.sbt,其中build.sbt为。
它解决了错误。(阅读互联网上的所有帖子3小时后。:-))