Question

I have a Maven project in Java. I am new to all of these concepts. I created a Restful project which works well with a file repository. But I want to change that to a mongo repository.

So I added my repository class, then I need to add the mongo libraries. I right click on the project and select Maven --> Update, but the libraries are not being downloaded. So I add them myself via Project Build path and this makes my project to compile.

However at runtime I get the exception of classNotFound for mongo classes.

I read some posts and added these line to pom.xml:

<dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongo-java-driver</artifactId>
    <version>1.3</version>
</dependency>

Still not compiling. How should I add the libraries in a way that it compiles and also at runtime my program can find those classes?

Was it helpful?

Solution

Where did you get 1.3 for a version? The latest is 2.12.1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top