Updated on 2024-08-16 GMT+08:00

Configuring and Importing a Project

Background

The installation directory of the Storm client contains a Storm development sample project. Import the sample project to Eclipse and start to learn the sample project.

Prerequisites

Ensure that the difference between the local PC time and the FusionInsight cluster time is less than 5 minutes. If the time difference cannot be determined, contact the system administrator. You can view time of the MRS cluster in the upper right corner on the MRS Manager page.

Procedure

  1. In the root directory of the Storm sample project, run the mvn install command to perform compilation.
  2. In the root directory of the Storm sample project, run the mvn eclipse:eclipse command to create an Eclipse project.
  3. 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.

  4. Set an Eclipse text file encoding format to prevent garbled characters.

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

      The Preferences window is displayed.

    2. In the navigation tree, choose General > Workspace. In the Text file encoding area, select Other and set the value to UTF-8. Click Apply and then OK. Figure 1 shows the settings.
      Figure 1 Setting the Eclipse encoding format

  5. If you submit a task to a cluster in the Windows environment, you need to map the cluster IP address to the local host file. Take Windows 7 as an example, the path is C:\Windows\System32\drivers\etc\hosts.

    Assume that the cluster has three nodes: 10.1.131.131, 10.1.131.132, and 10.1.131.133.

    Check whether the following information is configured in the hosts file.
    10.1.131.131 10-1-131-131
    10.1.131.132 10-1-131-132
    10.1.131.133 10-1-131-133