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
- Obtain the sample project from the src/iotdb-examples directory in the directory where the sample code is decompressed by referring to Obtaining the MRS Application Development Sample Project. You can select a sample based on the actual service scenario.
- To debug iotdb-flink-example, iotdb-jdbc-example, iotdb-kafka-example, or iotdb-session-example sample code on the local Windows environment, perform the following operations:
Configure the com.huawei.bigdata.iotdb.IoTDBProperties class in the ..\src\main\resources directory of each sample project, change the value of proPath in the IoTDBProperties() method to the absolute path of the iotdb-example.properties file.Figure 1 Configuring the proPath parameter
- Modify the iotdb-example.properties file in the ..\src\main\resources directory of each sample project.
jdbc_url=jdbc:iotdb://IP address of the IoTDBServer instance:IoTDBServer RPC port # Username for authentication username=developuser # User password for authentication. It is recommended that the password be stored in ciphertext and decrypted when being used. password=xxx
- After the IntelliJ IDEA and JDK tools are installed, configure the JDK in IntelliJ IDEA.
- Start IntelliJ IDEA and choose Configure.
Figure 2 Quick Start
- Select Structure for New Projects from the drop-down list.
Figure 3 Configure
- On the displayed Project Structure for New Projects page, select SDKs, click the plus sign (+), and click JDK.
Figure 4 Project Structure for New Projects
- On the Select Home Directory for JDK page that is displayed, select the JDK directory and click OK.
Figure 5 Select Home Directory for JDK
- After selecting the JDK, click OK to complete the configuration.
Figure 6 Completing the JDK configuration
The operation procedure may vary according to the IDEA version.
- Start IntelliJ IDEA and choose Configure.
- Import the sample project to the IntelliJ IDEA development environment.
- 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 7 Open or Import (quick start page)
- Select the pom.xml file of iotdb-jdbc-example in the sample project folder iotdb-examples, and click OK.
Select Open as Project.
- After the import is complete, check that the imported sample projects are displayed on the IDEA home page.
Figure 8 Successfully importing sample projects
- Start the IntelliJ IDEA, and click Open or Import on the quick start page.
- Set the Maven version used by the project.
- Choose File > Settings... from the main menu of IntelliJ IDEA.
Figure 9 Settings
- 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 10 Selecting the local Maven installation directory
- Click Apply and OK to complete the configuration.
- Choose File > Settings... from the main menu of IntelliJ IDEA.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot