SBT 没有解决 sbt-heroku 插件依赖

Posted

技术标签:

【中文标题】SBT 没有解决 sbt-heroku 插件依赖【英文标题】:SBT not resolving sbt-heroku plugin dependency 【发布时间】:2014-12-27 19:21:16 【问题描述】:

我正在将我的应用程序从 RUN@Cloud 移动到 Heroku。我尝试使用 sbt-heroku 插件将应用程序部署到 Heroku。依赖项不想解决。

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.heroku#sbt-heroku;0.1.5: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

sbt 版本是 0.13.1。 Build.scala 文件内容:

object ApplicationBuild extends Build 

  val appName = "happymelly-teller"
  val appVersion = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    jdbc,
    cache,
    filters,
    "be.objectify" %% "deadbolt-scala" % "2.2-RC2",
    "com.andersen-gott" %% "scravatar" % "1.0.3",
    "com.github.tototoshi" %% "slick-joda-mapper" % "0.4.0",
    "com.typesafe.play" %% "play-slick" % "0.5.0.8",
    "com.heroku" % "sbt-heroku" % "0.1.5",
    //"com.typesafe.slick" %% "slick" % "1.0.1",
    "mysql" % "mysql-connector-java" % "5.1.27",
    "org.apache.poi" % "poi" % "3.9",
    "org.apache.poi" % "poi-ooxml" % "3.9",
    "org.joda" % "joda-money" % "0.9",
    "org.pegdown" % "pegdown" % "1.4.2",
    "org.planet42" %% "laika-core" % "0.5.0",
    "org.jsoup" % "jsoup" % "1.7.3",
    // update selenium to avoid browser test to hang
    "org.seleniumhq.selenium" % "selenium-java" % "2.39.0",
    "ws.securesocial" %% "securesocial" % "2.1.3",
    "nl.rhinofly" %% "play-s3" % "3.3.3"
  )

  val main = play.Project(appName, appVersion, appDependencies).settings(scalariformSettings: _*).settings(
    resolvers += Resolver.url("heroku-sbt-plugin-releases", url("https://dl.bintray.com/heroku/sbt-plugins/"))(Resolver.ivyStylePatterns),
    resolvers += Resolver.url("sbt-plugin-releases", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns),
    resolvers += Resolver.url("Objectify Play Snapshot Repository", url("http://schaloner.github.com/snapshots/"))(Resolver.ivyStylePatterns),
    resolvers += Resolver.url("Objectify Play Repository", url("http://schaloner.github.com/releases/"))(Resolver.ivyStylePatterns),
    resolvers += "Rhinofly Internal Repository" at "http://maven-repository.rhinofly.net:8081/artifactory/libs-release-local",
    resolvers += Resolver.sonatypeRepo("releases"),
    routesImport += "binders._"
  ).settings(
      /* Scalariform: override default settings - no spaces within pattern binders is the only option in IntelliJ IDEA,
        preserve spaces before arguments is needed for infix function syntax (unconfirmed).*/
      ScalariformKeys.preferences := FormattingPreferences().
        setPreference(SpacesWithinPatternBinders, false).
        setPreference(RewriteArrowSymbols, true).
        setPreference(PreserveSpaceBeforeArguments, true)
      // Avoid building Scaladocs and sources to reduce build time.
    ).settings(sources in(Compile, doc) := Seq.empty
    ).settings(publishArtifact in(Compile, packageDoc) := false
    ).settings(publishArtifact in(Compile, packageSrc) := false)


我尝试了几个版本的插件(不仅是 0.1.5,还有 0.1.4 和 0.1.3),但都没有成功。有人遇到过这个问题吗?

【问题讨论】:

【参考方案1】:

试试

"com.heroku" %% "sbt-heroku" % "0.1.5"

另外,您应该在plugins/plugins.sbt 文件中添加以下行

resolvers += Resolver.url("heroku-sbt-plugin-releases",
  url("https://dl.bintray.com/heroku/sbt-plugins/"))(Resolver.ivyStylePatterns)

addSbtPlugin("com.heroku" % "sbt-heroku" % "0.1.5")

【讨论】:

我尝试了“%%”,但没有成功。在 plugins.sbt 和 Build.scala 中使用解析器和插件数据有什么区别吗? 您是否按照 github.com repo 上的说明进行操作? 我跟着。它没有帮助我。我尝试将插件数据同时放入 plugins.sbt 和 Build.scala 我做到了。我尝试将插件数据同时放入 plugins.sbt 和 Build.scala。在前一种情况下,我又遇到了另一个错误:找不到 herokuAppName。我想是因为没有插件。 那么前一个问题应该通过在你的build.sbt而不是你的Build.scala中这样做herokuAppName in Compile := "your-heroku-app-name"来解决

以上是关于SBT 没有解决 sbt-heroku 插件依赖的主要内容,如果未能解决你的问题,请参考以下文章

play-sbt 2.5.6 插件给出未解决的依赖错误

如何解决具有不同包装常春藤类型的sbt中的依赖关系?

sbt共享项目之间的依赖关系

如何解决 sbt 中具有不同包装 ivy 类型的依赖项?

从`sbt compile`中排除测试依赖解析

是否有一个sbt插件来获取像Gemfile中的依赖项?