Configuring and Importing Sample Projects
Background
The Storm development example project is included in the Storm client installation directory. Import the project to IntelliJ IDEA for learning.
Prerequisites
Ensure that the difference between the local PC time and the cluster time is less than 5 minutes. If the time difference cannot be determined, contact the system administrator. You can view the cluster time in the lower-right corner on FusionInsight Manager.
Procedure
- Obtain the sample project folder storm-examples in the src\storm-examples directory where the sample code is decompressed. For details, see Obtaining Sample Projects from Huawei Mirrors.
- Copy the files user.keytab and krb5.conf files obtained in Preparing a Developer Account section and the cluster configuration file obtained in section Preparing an Operating Environment to the storm-examples\src\main\resources directory of the sample project.
- To submit a topology when no client is installed in Windows or Linux, you need to place both streaming-site.xml and storm.yaml in the storm-examples\src\main\resources directory of the sample project.
- To submit a topology when the client is installed in Linux, you only need to place streaming-site.xml in the storm-examples\src\main\resources directory of the sample project.
- After installing the IntelliJ IDEA and JDK tools, configure JDK in IntelliJ IDEA.
- Open IntelliJ IDEA and click Configure.
Figure 1 Quick Start
- Choose Project Defaults > Project Structure.
Figure 2 Configure
- In the displayed Project Structure for New Projects interface, click SDKs. Then click the plus sign (+) and choose JDK.
Figure 3 Project Structure for New Projects
- In the displayed Select Home Directory for JDK interface, select the JDK directory, and click OK.
Figure 4 Select Home Directory for JDK
- Click OK.
Figure 5 Completing the JDK configuration
- Open IntelliJ IDEA and click Configure.
- In the application development environment, import the sample project to the IntelliJ IDEA development environment.
- Configure the IntelliJ IDEA Maven project environment.
Choose File > Settings and search for Maven. Configure the Maven project, and choose Apply > OK.
Figure 6 Configuring the IntelliJ IDEA Maven project environment
- Choose File > New > Project from Existing Sources…. .
Figure 7 The Project from Existing Sources.... page is displayed
- Select the sample project to be imported, for example, storm-examples.
Figure 8 Selecting the sample project to be imported
- Import the project as a Maven project.
Figure 9 Importing the project as a Maven project.
- Configure the IntelliJ IDEA Maven project environment.
- Set the IntelliJ IDEA text file coding format to prevent garbled characters.
- On the IntelliJ IDEA menu bar, choose File > Settings.
The Settings window is displayed.
- In the navigation tree, choose Editor > File Encodings. In the Project Encoding area and Global Encoding area, set the value to UTF-8, click Apply, and click OK, as shown in Figure 10.
- On the IntelliJ IDEA menu bar, choose File > Settings.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.