[英]sbt maven local resolver doesn't work when using Build.scala
我以前在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] ::::::::::::::::::::::::::::::::::::::::::::::
为什么它会停止工作以及如何解决这个问题?
这个解决方案对我有用:
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:_*)
我看到的主要区别是,我明确地将解析器设置添加到项目中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.