Updated on 2023-08-31 GMT+08:00

Configuring and Importing a Sample Project

Context

Obtain the IoTDB development sample project and import the project to IntelliJ IDEA to learn the sample project.

Procedure

  1. Obtain the sample project folder iotdb-jdbc-example in the src/iotdb-examples directory where the sample code is decompressed. For details, see Obtaining Sample Projects from Huawei Mirrors.
  2. After the IntelliJ IDEA and JDK tools are installed, configure the JDK in IntelliJ IDEA.

    1. Start IntelliJ IDEA and choose Configure.
      Figure 1 Quick Start
    2. Select Structure for New Projects from the drop-down list.
      Figure 2 Configure
    3. On the displayed Project Structure for New Projects page, select SDKs, click the plus sign (+), and click JDK.
      Figure 3 Project Structure for New Projects
    4. On the Select Home Directory for JDK page that is displayed, select the JDK directory and click OK.
      Figure 4 Select Home Directory for JDK
    5. After selecting the JDK, click OK to complete the configuration.
      Figure 5 Completing the JDK configuration

      The operation procedure may vary according to the IDEA version.

  3. Import the sample project to the IntelliJ IDEA development environment.

    1. Start the IntelliJ IDEA, and click Open or Import on the quick start page.

      For the IDEA tool that has been used, you can choose File > Import project... on the main interface to import the sample project.

      Figure 6 Open or Import (quick start page)
    2. Select the pom.xml file of iotdb-jdbc-example in the sample project folder iotdb-examples, and click OK.

      Select Open as Project.

    3. After the import is complete, check that the imported sample projects are displayed on the IDEA home page.
      Figure 7 Successfully importing sample projects

  4. Set the Maven version used by the project.

    1. Choose File > Settings... from the main menu of IntelliJ IDEA.
      Figure 8 Settings
    2. Choose Build, Execution, Deployment > Maven and set Maven home directory to the Maven version installed on the local host.
      Configure User settings file and Local repository based on the site requirements.
      Figure 9 Selecting the local Maven installation directory
    3. Click Apply and OK to complete the configuration.