【问题标题】:sbt maven local resolver doesn't work when using Build.scalasbt maven 本地解析器在使用 Build.scala 时不起作用
【发布时间】:2014-04-20 11:47:10
【问题描述】:

我曾经在我的 build.sbt 文件中定义我的依赖项以供我玩!应用程序,但现在我有多个项目我尝试在我的 build.scala 文件中执行此操作:

resolvers += Resolver.mavenLocal

val webDependencies = Seq(
..
..
"com.example" % "blah" % "0.0.1-SNAPSHOT"
)

当我尝试运行或编译时,它说由于某种原因它无法解决依赖关系。我在 build.sbt 中有完全相同的东西并且它有效,但现在它在 build.scala 中不起作用。

错误显示如下:

[info] Resolving com.example#blah;0.0.1-SNAPSHOT ...
[warn]  module not found: com.example#blah;0.0.1-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/blankman/.ivy2/local/com.example/blah/0.0.1-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/blah/blah/0.0.1-SNAPSHOT/blah-0.0.1-SNAPSHOT.pom
[warn] ==== Typesafe Releases Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/org/blah/blah/0.0.1-SNAPSHOT/blah-0.0.1-SNAPSHOT.pom
[warn] ==== Typesafe Releases Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/org/blah/blah/0.0.1-SNAPSHOT/blah-0.0.1-SNAPSHOT.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.example#blah;0.0.1-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

为什么它会停止工作以及关于如何解决此问题的任何想法?

【问题讨论】:

    标签: scala playframework sbt


    【解决方案1】:

    这个解决方案对我有用:

    val buildResolvers = resolvers ++= Seq(
        "Local Maven Repository"    at "file://"+Path.userHome.absolutePath+"/.m2/repository",
        "Typesafe Repo"             at "http://repo.typesafe.com/typesafe/releases/",
        "Sonatype Snapshots"        at "http://oss.sonatype.org/content/repositories/snapshots",
        "Sonatype Releases"         at "http://oss.sonatype.org/content/repositories/releases"
      )
    
    def MyProject(name: String) = {
        Project(id = name, base = file(name)).
          settings(buildResolvers:_*)
    

    我看到的主要区别是我明确地将解析器设置添加到项目中。

    【讨论】:

    猜你喜欢
    • 2013-05-26
    • 1970-01-01
    • 2019-01-14
    • 2015-07-02
    • 2017-06-18
    • 2016-05-24
    • 2013-01-12
    • 2015-09-17
    • 2020-01-05
    相关资源
    最近更新 更多