Knows Not Much
Knows Not Much

Reputation: 31546

SBT Cannot find Jar from Local Maven Repository

I registered a jar file in my local maven repo as follows

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

Then I successfully used it in a maven pom.xml java project as follows

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

Next I need to write a scala project and I need to use this Jar. So in my SBT file I use this jar as follows

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

However SBT throws an error saying

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)

Upvotes: 0

Views: 1275

Answers (1)

Knows Not Much
Knows Not Much

Reputation: 31546

I solved it myself. Posting the answer here

You need to add the local maven repo in sbt built.sbt file as follows

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

Upvotes: 2

Related Questions