|
| 1 | +.. _kotlin-sync-download-install: |
| 2 | + |
| 3 | +==================== |
| 4 | +Download and Install |
| 5 | +==================== |
| 6 | + |
| 7 | +This guide demonstrates how to create a project and add the |
| 8 | +{+driver-short+} dependencies by using `Gradle <https://gradle.org/>`__ |
| 9 | +or `Maven <https://maven.apache.org/>`__. |
| 10 | + |
| 11 | +.. procedure:: |
| 12 | + :style: connected |
| 13 | + |
| 14 | + .. step:: Create a {+language+} Project |
| 15 | + |
| 16 | + First, make sure that your system has {+language+} installed and |
| 17 | + running on JDK 1.8 or later. |
| 18 | + |
| 19 | + We recommend that you use an integrated development |
| 20 | + environment (IDE) such as IntelliJ IDEA or Eclipse IDE to |
| 21 | + configure Gradle or Maven to build and run your project. |
| 22 | + |
| 23 | + .. tip:: |
| 24 | + |
| 25 | + If you are not using an IDE, see the |
| 26 | + `Creating New Gradle Builds |
| 27 | + <https://guides.gradle.org/creating-new-gradle-builds/>`__ guide |
| 28 | + or the `Building Maven |
| 29 | + <https://maven.apache.org/guides/development/guide-building-maven.html>`__ guide |
| 30 | + for more information on how to set up your project. |
| 31 | + |
| 32 | + For more information on getting started with |
| 33 | + {+language+} and creating your first project, see `Get started with Kotlin/JVM |
| 34 | + <{+kotlin-docs+}/docs/jvm-get-started.html>`__ in the {+language+} |
| 35 | + language documentation. |
| 36 | + |
| 37 | + .. step:: Add MongoDB as a Dependency |
| 38 | + |
| 39 | + If you are using Gradle to manage your |
| 40 | + packages, add the following entry to your ``build.gradle.kts`` |
| 41 | + dependencies list: |
| 42 | + |
| 43 | + .. include:: /includes/kotlin-sync-driver-gradle-versioned.rst |
| 44 | + |
| 45 | + If you are using Maven to manage your |
| 46 | + packages, add the following entry to your ``pom.xml`` dependencies list: |
| 47 | + |
| 48 | + .. include:: /includes/kotlin-sync-driver-maven-versioned.rst |
| 49 | + |
| 50 | + After you configure your dependencies, ensure that they are |
| 51 | + available to your project by running the dependency manager and |
| 52 | + refreshing the project in your IDE. |
| 53 | + |
| 54 | + .. step:: Add Serialization Library Dependencies |
| 55 | + |
| 56 | + To enable the driver to convert between {+language+} objects and BSON, the |
| 57 | + data format for documents in MongoDB, you must also add one or both of the |
| 58 | + following serialization packages to your application: |
| 59 | + |
| 60 | + - ``bson-kotlinx`` *(Recommended)* |
| 61 | + - ``bson-kotlin`` |
| 62 | + |
| 63 | + If you are using Gradle to manage your packages, add one of the following |
| 64 | + entries to your ``build.gradle.kts`` dependencies list: |
| 65 | + |
| 66 | + .. include:: /includes/serialization-libs-gradle-versioned.rst |
| 67 | + |
| 68 | + If you are using Maven to manage your packages, add one of the following |
| 69 | + entries to your ``pom.xml`` dependencies list: |
| 70 | + |
| 71 | + .. include:: /includes/serialization-libs-maven-versioned.rst |
| 72 | + |
| 73 | + After you configure your dependencies, ensure that they are available to your |
| 74 | + project by running the dependency manager and refreshing the |
| 75 | + project in your IDE. |
| 76 | + |
| 77 | +.. To learn more about these packages, see |
| 78 | +.. :ref:`kotlin-sync-serialization`. |
| 79 | + |
| 80 | +After you complete these steps, you have a new project directory |
| 81 | +and the driver dependencies installed. |
| 82 | + |
| 83 | +.. include:: /includes/get-started/quickstart-troubleshoot.rst |
| 84 | + |
| 85 | +.. button:: Next: Create a MongoDB Deployment |
| 86 | + :uri: /get-started/create-a-deployment/ |
0 commit comments