Configuring and Importing Sample Projects
Scenario
MapReduce provides sample projects for multiple scenarios to help you quickly learn MapReduce projects.
The procedure of importing MapReduce example codes is described as follows: Figure 1 shows the procedure.
Procedure
- Obtain the sample project mapreduce-example-normal in the src directory where the sample code is decompressed. For details, see Obtaining Sample Projects from Huawei Mirrors.
- Import the example project to the IntelliJ IDEA development environment.
- Open IntelliJ IDEA and choose .
- Choose the directory of the example project mapreduce-example-normal. Click OK.
- 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.
- Choose Editor > File Encodings from the navigation tree. In the "Global Encoding" and "Project Encodings" area, set the value to UTF-8, click Apply, and click OK, as shown in Figure 2
- On the IntelliJ IDEA menu bar, choose File > Settings.
- Add the configuration information such as the address of the open-source image repository to the setting.xml configuration file of the local Maven by referring to Configuring Huawei Open Source Mirrors.
On the IntelliJ IDEA page, select File > Settings > Build, Execution, Deployment > Build Tools > Maven, select Override next to User settings file, and change the value of User settings file to the directory where the settings.xml file is stored. Ensure that the directory is <Local Maven installation directory>\conf\settings.xml.Figure 3 Directory for storing the settings.xml file
Reference
The dependency packages mapped to the sample projects of MapReduce are as follows:
- MapReduce accessing multi-components sample project
- If you want to use the multi-component accessing sample project after importing a sample project, ensure that the HBase service have been installed in the cluster.
- If you do not use the multi-components accessing sample project, you can ignore errors about the multi-components accessing sample project as long as the compilation of the statistics sample project is not affected. Otherwise, delete the files about the multi-components accessing sample project after importing the sample projects.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.