SBT忽略文件解析器到本地maven repo

时间:2015-04-24 10:42:02

标签: scala maven sbt

我试图使用发布到本地maven repo的依赖项。我在Windows下使用带有JDK8的SBT 0.13.7。以下是我在build.scala

中尝试过的内容
resolvers ++= {
  val mavenLocal = Resolver.file("local2", file(Path.userHome + "/.m2/repository"))(Resolver.mavenStylePatterns)

  Seq(
    mavenLocal,
// Resolver.publishMavenLocal,
    "spray releases" at "http://repo.spray.io/",
    "spray nightlies" at "http://nightlies.spray.io/",
    "jasperreports" at "http://jasperreports.sourceforge.net/maven2/",
    "Akka Snapshot Repository" at "http://repo.akka.io/snapshots/",
    "Miredot" at "http://nexus.qmino.com/content/repositories/miredot"
  )
}

奇怪的是,它对我不起作用。我监控系统文件活动,SBT甚至没有尝试去上面提到的文件夹。我甚至尝试使用提供的Resolver.publishMavenLocal

以下是我在日志中的内容

[warn]  module not found: com.wordnik#swagger-jersey2-jaxrs;1.5.2-M2-SNAPSHOT
[warn] ==== local: tried
[warn]   C:\Users\root\.ivy2\local\com.wordnik\swagger-jersey2-jaxrs\1.5.2-M2-SNAPSHOT\ivys\ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/wordnik/swagger-jersey2-jaxrs/1.5.2-M2-SNAPSHOT/swagger-jersey2-jaxrs-1.5.2-M2-SNAPSHOT.pom
[warn] ==== local2: tried
[warn] ==== spray releases: tried
[warn]   http://repo.spray.io/com/wordnik/swagger-jersey2-jaxrs/1.5.2-M2-SNAPSHOT/swagger-jersey2-jaxrs-1.5.2-M2-SNAPSHOT.pom
[warn] ==== spray nightlies: tried
[warn]   http://nightlies.spray.io/com/wordnik/swagger-jersey2-jaxrs/1.5.2-M2-SNAPSHOT/swagger-jersey2-jaxrs-1.5.2-M2-SNAPSHOT.pom
[warn] ==== jasperreports: tried
[warn]   http://jasperreports.sourceforge.net/maven2/com/wordnik/swagger-jersey2-jaxrs/1.5.2-M2-SNAPSHOT/swagger-jersey2-jaxrs-1.5.2-M2-SNAPSHOT.pom
[warn] ==== Akka Snapshot Repository: tried
[warn]   http://repo.akka.io/snapshots/com/wordnik/swagger-jersey2-jaxrs/1.5.2-M2-SNAPSHOT/swagger-jersey2-jaxrs-1.5.2-M2-SNAPSHOT.pom
[warn] ==== Miredot: tried
[warn]   http://nexus.qmino.com/content/repositories/miredot/com/wordnik/swagger-jersey2-jaxrs/1.5.2-M2-SNAPSHOT/swagger-jersey2-jaxrs-1.5.2-M2-SNAPSHOT.pom

我错过了什么吗?

3 个答案:

答案 0 :(得分:3)

当我需要从本地maven存储库导入库时,我通常会使用这一行:

resolvers += "Local Maven" at Path.userHome.asFile.toURI.toURL + ".m2/repository"

答案 1 :(得分:0)

除非您尝试执行以下操作,否则SBT 1.3.8不会解析本地Maven:

  • c:\Users\mac\\.sbt\下添加一个具有名称存储库的文件,然后添加:

    [repositories]
    
    maven-local 
    
  • 以参数-Dsbt.override.build.repos=true开始sbt。

仔细阅读sbt在线文档,即可找到答案。

答案 2 :(得分:0)

resolvers += Resolver.mavenLocal