Skip to main content

Add Dependencies

Starting with 6.8.1, the driver provides a regular package and an alone package with the same database capabilities.

ComparisonRegular packagealone package
PackagingSelected components are embedded; remaining dependencies are resolved by Maven/GradleThe driver and all required runtime dependencies are shaded into one JAR
SDK versionAn external MongoDB Java Driver version can be selected, subject to compatibilityFixed in the JAR; cannot be selected independently
AdvantageControl the SDK version to fit application requirementsOne JAR, with no need to assemble its runtime dependencies
Trade-offMore dependency coordination when managing versions or loading JARs manuallyLarger JAR; embedded SDK version follows the driver build
ExampleJava applications requiring a specific compatible SDK versionDataGrip, DBeaver, or application development using the bundled SDK

The regular package resolves MongoDB Java Driver (org.mongodb:mongodb-driver-sync) as an external dependency. You can select a compatible SDK version through Maven dependency management or Gradle version constraints. Verify compatibility when changing versions; this does not imply support for arbitrary major versions.

Regular Package​

For Maven/Gradle application development, use either configuration below. No classifier is needed.

Maven​

<dependency>
<groupId>net.hasor</groupId>
<artifactId>jdbc-mongo</artifactId>
<version>6.8.2</version>
</dependency>

Gradle​

repositories {
mavenCentral()
}

dependencies {
implementation "net.hasor:jdbc-mongo:6.8.2"
}

For manual loading, the regular JAR must be accompanied by the external dependencies declared in its POM.

Standalone Package​

Choose alone when you want a single driver JAR and do not need to customize its embedded SDK version. It can be used both in JDBC tools and in application code. Shading bundles the runtime dependencies; it does not mean every dependency has its package names relocated.

Maven​

Copy the complete dependency below into pom.xml. The classifier selects the -alone.jar artifact of the same driver and version.

<dependency>
<groupId>net.hasor</groupId>
<artifactId>jdbc-mongo</artifactId>
<version>6.8.2</version>
<!-- Select the self-contained JAR -->
<classifier>alone</classifier>
<!-- Dependencies are already bundled; do not fetch duplicate JARs -->
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

Gradle​

The final :alone in the coordinate selects the standalone artifact.

repositories {
mavenCentral()
}

dependencies {
implementation("net.hasor:jdbc-mongo:6.8.2:alone") {
// Dependencies are already bundled in the alone JAR
transitive = false
}
}

Both artifacts share a POM. The Maven exclusions and Gradle transitive = false above prevent dependency managers from fetching libraries already bundled in alone; they do not remove classes from that JAR.

For driver downloads, URL templates and DataGrip/DBeaver setup, see SQL Client.

Use only one package type for a given driver. Do not load the regular JAR and alone together or add another SDK JAR to replace the embedded version. Neither package includes the dbVisitor ORM module; add it separately if needed.