質問

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?

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top