mavenintellij-ideamongodbcasbahmongodb-scala

maven throwing error when adding casbah to it


I have added casbah to my dependancies using

  <dependency>
  <groupId>com.mongodb.casbah</groupId>
  <artifactId>casbah_2.8.0</artifactId>
  <version>2.1.5.0</version>
  </dependency>

Then i just wrote a simple mongo connection statement

 val mongoConn = MongoConnection()
 val mongoDB = mongoConn("test")
 val newObj = MongoDBObject("foo" -> "bar","x"->"y","pie"->3.14,"spam"->"eggs")

Then i compiled it

mvn compile

But it is throwing errors that it cannot find the goal

[ERROR] Failed to execute goal on project test-project: Could not resolve depend
encies for project org.scala-lang:test-project:jar:default: Could not find artif
act com.mongodb.casbah:casbah_2.8.0:jar:2.1.5.0 in scala-tools.org (http://scala
-tools.org/repo-releases) -> [Help 1]

Can some one tell me what the problem is. I didnt make any other changes to the POM other than adding this dependancy. Truth is i dont know what else to change in it. But i also observed that intellij idea shows auto complete options for casbah objects and classes, all this is so confusing for me.


Solution

  • Try specifying the below(note the type), replace scala.version with 2.8.0 or which version you are using.

      <dependency>
          <groupId>com.mongodb.casbah</groupId>
          <artifactId>casbah_${scala.version}</artifactId>
          <version>2.1.5-1</version>
          <scope>compile</scope>
          <type>pom</type>
        </dependency>