Local dependencies resolved by SBT but not by Play! Framework

筅森魡賤 提交于 2020-01-01 03:09:10

问题


I'm trying to use banana-RDF, a locally published library (published using SBT's publish-local) from a Play! Framework project, but when running compile from Play's console, the wanted library is not resolved, when using compile from SBT's console everything goes fine.

I find this behavior pretty weird as Play uses SBT to resolve dependencies. By the way, I'm using the 0.12.3 version of SBT in my Play project.

The error I'm getting when compiling with Play is pretty basic:

[warn]  module not found: org.w3#banana_2.10;2013_02_21-SNAPSHOT            
[warn] ==== local: tried
[warn]   /home_local/.installedSoftware/play-2.1.1/repository/local/org.w3/banana_2.10/2013_02_21-SNAPSHOT/ivys/ivy.xml
[warn] ==== Typesafe Releases Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Typesafe Snapshots Repository: tried
[warn]   http://repo.typesafe.com/typesafe/snapshots/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Akka Snapshots: tried
[warn]   http://repo.akka.io/snapshots/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== OSS117: tried
[warn]   http://oss.sonatype.org/content/repositories/snapshots/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Local Maven Repository: tried
[warn]   file:///home_local/.m2/repository/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Local SBT Repository: tried
[warn]   file:///home_local/.ivy2/local/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom

Can anyone explain what is happening here? Thank you in advance.


回答1:


The problem is that SBT's publish-local publishes your library to ~/.ivy2/local, whereas Play seems to have his ivy2 local repository pointer to the ivy2 repository of his own installation folder (your /home_local/.installedSoftware/play-2.1.1/repository/local).

You can add for example this resolver to your Play's Build.scala:

resolvers += Resolver.file("Local repo", file(System.getProperty("user.home") + "/.ivy2/local"))(Resolver.ivyStylePatterns)


来源:https://stackoverflow.com/questions/16400877/local-dependencies-resolved-by-sbt-but-not-by-play-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!