Issue adding MongoDB Java Driver as a Maven dependency

The title says it all really, my pom is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>CouncillorsApp</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongo-java-driver</artifactId>
            <version>3.12.6</version>
        </dependency>
    </dependencies>
</project>

The following error is given:

“Dependency ‘org.mongodb:mongodb-driver-sync:3.10.2’ not found”

I’m using Java 14.0.2 and the latest version of IntelliJ

Answer

So after restarting IntelliJ the above code seems to work fine. I’m unsure of where the issue was, but the dependency is being found now without any changes to the pom.

Leave a Reply

Your email address will not be published. Required fields are marked *