简体   繁体   中英

How to config sbt maven dependency not including scala version

I want to include a maven module mongo-hadoop-core in a scala project.

Here is the .sbt file:

name := "Simple Project"

version := "1.0"

scalaVersion := "2.10.5"

libraryDependencies += "org.apache.spark" %% "spark-core" % "1.6.1"

libraryDependencies += "org.mongodb.mongo-hadoop" %% "mongo-hadoop-core" % "1.5.0"

but when run sbt package and it will complain about not finding the mongo-hadoop-core_2.10 dependency:

[warn]  module not found: org.mongodb.mongo-hadoop#mongo-hadoop-core_2.10;1.5.0
[warn] ==== local: tried
[warn]   /home/ximing/.ivy2/local/org.mongodb.mongo-hadoop/mongo-hadoop-core_2.10/1.5.0/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/mongodb/mongo-hadoop/mongo-hadoop-core_2.10/1.5.0/mongo-hadoop-core_2.10-1.5.0.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.mongodb.mongo-hadoop#mongo-hadoop-core_2.10;1.5.0: not found

And I think this may because sbt try to include mongo-hadoop-core_2.10 instead of just mongo-hadoop-core package. It seemed sbt append a scala version arbitrarily (on the compatibility concern ?). How can I tell sbt not worry about that and just download and include the mongo-hadoop-core module anyway?

Use libraryDependencies += "org.mongodb.mongo-hadoop" % "mongo-hadoop-core" % "1.5.0" .

The %% is what adds the Scala version to the name and is used for Scala libraries only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM