我已将一个本地repo解析器行放入build.sbt:
resolvers += "Local Repo" at "file://" + Path.userHome.absolutePath + "/.m2/repository"
我还使用mvn install
在本地安装了一个文件mvn org.apache.maven.plugins:maven-install-plugin:2.5.1:install-file -Dfile=c:\shared\py4j-0.8.1.jar -DgroupId=net.sf.py4j -DartifactId=py4j -Dversion=0.7 -Dpackaging=jar
在这里,我们可以看到文件已安装到本地仓库:
C:\Users\S80035683\.m2\repository\net\sf>dir C:\Users\S80035683\.m2\repository\net\sf\py4j\py4j\0.7\py4j-0.7.pom
Directory of C:\Users\S80035683\.m2\repository\net\sf\py4j\py4j\0.7
05/13/2014 12:52 PM 457 py4j-0.7.pom
但是在构建过程中找不到文件:
[warn] module not found: net.sf.py4j#py4j;0.7
[warn] ==== local: tried
[warn] C:\Users\S80035683\.ivy2\local\net.sf.py4j\py4j\0.7\ivys\ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/net/sf/py4j/py4j/0.7/py4j-0.7.pom
[warn] ==== Apache repo: tried
[warn] https://repository.apache.org/content/repositories/releases/net/sf/py4j/py4j/0.7/py4j-0.7.pom
[warn] ==== Cloudera repo: tried
[warn] https://repository.cloudera.com/artifactory/repo/org/apache/kafka/kafka/0.7.2-spark/net/sf/py4j/py4j/0.7/py4j-0.7.pom
[warn] ==== Local Repo: tried
[warn] file://C:/Users/S80035683/.m2/repository/net/sf/py4j/py4j/0.7/py4j-0.7.pom
特别注意最后一行:
文件:// C:/Users/S80035683/.m2/repository/net/sf/py4j/py4j/0.7/py4j-0.7.pom
这与我们之前安装的路径相同 - 即文件确实存在
C:\Users\S80035683\.m2\repository\net\sf>dir C:\Users\S80035683\.m2\repository\net\sf\py4j\py4j\0.7\py4j-0.7.pom
Directory of C:\Users\S80035683\.m2\repository\net\sf\py4j\py4j\0.7
05/13/2014 12:52 PM 457 py4j-0.7.pom
答案 0 :(得分:0)
问题是特定于Windows的。还有一个问题对如何解决有帮助。
SBT doesn't find file in local maven repository although it's there
具体可以使用以下三种解决方法之一:
file:// needs to be file:///
(特定于Windows ..)
OR:更好/便携式解决方案:
resolvers += Resolver.mavenLocal
OR
resolvers += "Local Maven Repository" at "file:///"+Path.userHome+"/.m2/repository"