2016-01-12 50 views
1

我在本地Maven回購註冊的jar文件如下SBT無法找到本地的倉庫罐

mvn install:install-file -Dfile=./hadoop-vertica.jar -DgroupId="com.hp" -DartifactId="mapred" -Dversion=1.0.0 -Dpackaging=jar 

然後我用它成功地在一個maven的pom.xml Java項目如下

<dependency> 
     <groupId>com.hp</groupId> 
     <artifactId>mapred</artifactId> 
     <version>1.0.0</version> 
     <scope>provided</scope> 
    </dependency> 

接下來我需要編寫一個scala項目,我需要使用這個jar。所以在我的SBT文件我用這個罐子如下

libraryDependencies ++= Seq(
    "com.hp" % "mapred" % "1.0.0" % "provided" 
) 

但是SBT拋出一個錯誤說

sbt.ResolveException: unresolved dependency: com.hp#mapred;1.0.0: not found 
    at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:291) 
    at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:188) 
    at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:165) 
    at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155) 
    at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155) 
    at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:132) 
    at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57) 
    at sbt.IvySbt$$anon$4.call(Ivy.scala:65) 

回答

1

我解決它自己。這裏

發佈答案您需要添加本地Maven回購在SBT built.sbt文件如下

resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository" 
+0

建議將其標記爲正確或刪除答案和問題。 –

+0

正確的方法是'resolvers + = Resolver.mavenLocal'。 –