Updated on 2022-09-14 GMT+08:00

Configuring and Importing a Sample Project

Prerequisites

Ensure that the time difference between a local computer and the MRS cluster is less than 5 minutes. Time of the MRS cluster can be viewed in the upper right corner on the MRS Manager page.

Figure 1 Time of the MRS cluster

Procedure

  1. Obtain the HBase sample project in Obtaining a Sample Project.
  2. In the root directory of the HBase sample project, that is, the pom.xml directory of the HBase sample project, open the CLI and run the mvn install command to compile the project.
  3. In the cmd window opened in 2, run the mvn eclipse:eclipse command to create an Eclipse project.
  4. Configure the Eclipse development environment.

    1. On the Eclipse menu bar, choose Window > Preferences.

    The Preferences window is displayed.

    2. Choose General > Workspace from the navigation tree. In the Text file encoding area, select Other, set the value to UTF-8, click Apply.

    For details, see Figure 2.

    Figure 2 Setting the Eclipse encoding format

    3. In the navigation tree on the left, choose Maven > User Settings. On the User Settings page, click Browse to import the settings.xml file of the Maven, click Apply, and then click OK.

    See Figure 3.
    Figure 3 Setting the Maven Development Environment of the Eclipse

  5. In the application development environment, import the sample project to the Eclipse development environment.

    1. Choose File > Import > General > Existing Projects into Workspace > Next > Browse.

      The Browse Folder dialog box is displayed.

    2. Select the sample project folder, and click Finish.