Configuring and Importing a Sample Project

Scenario

Kudu provides sample projects for multiple scenarios to help you quickly learn Kudu projects.

Procedure

  1. Obtain the Kudu sample project. For details, see Obtaining Sample Projects from Huawei Mirrors.
  2. Import the sample project to the IntelliJ IDEA development environment.

    1. Open IntelliJ IDEA and choose File > Open.
    2. In the Open File or Project dialog box, select the sample project folder examples and click OK.

  3. Adjust the package path.

  4. Compile the pom.xml file by referring to the Huawei open-source image configuration method and add the Maven repository of the project.
  5. Edit the pom.xml file and add dependency packages.

  6. Add assembly-plugin to the pom.xml file and change the value of mainClass.

  7. Set the text file encoding format of IntelliJ IDEA to avoid garbled characters.

    1. Choose File > Settings from the main menu of IntelliJ IDEA.
    2. In the displayed Settings window, choose Editor > File Encodings in the navigation tree. In the Global Encoding and Project Encodings areas, set the parameter to UTF-8. Click Apply > OK, as shown in Figure 1.
    Figure 1 Setting the encoding format of IntelliJ IDEA