Help Center> MapReduce Service> Developer Guide (2.x and Earlier)> Method of Building an MRS Sample Project

Method of Building an MRS Sample Project

Procedure

The procedure of building an MRS sample project consists of three steps:

  1. Download the Maven project source code and configuration files of the sample project. For details, see Obtaining a Sample Project.
  2. Configure the Maven mirror repository of the SDK in the HUAWEI CLOUD mirror center. For details, see Configuring an Open Source Mirror on HUAWEI CLOUD.
  3. Build a complete Maven project by following instructions in the environment preparation section of each component based on your requirements.

Obtaining a Sample Project

Figure 1 Downloading sample code

Configuring an Open Source Mirror on HUAWEI CLOUD

HUAWEI CLOUD provides an open source mirror center for you to download all dependency JAR files of the MRS sample project. However, you need to download the rest dependency open source JAR files from the Maven central repository.

Perform the following steps to configure the open source mirror on HUAWEI CLOUD.

  1. Ensure that you have installed JDK 1.8 or later and Maven 3.0 or later.
  2. Visit and log in to Huawei Mirrors.
  3. Download the settings.xml file provided by Huawei Mirrors, and overwrite the <Maven installation directory>/conf/settings.xml file with the downloaded file.

    If the file cannot be downloaded, search for HuaweiCloud SDK at Huawei Mirrors, click HuaweiCloud SDK, and perform operations as prompted.

  4. Perform the following operations to manually modify the setting.xml configuration file or the pom.xml file in the component sample project to configure the image repository address:

    • Configuration method 1

      Add the following open source mirror repository address to the mirrors node in the setting.xml configuration file.

      <mirror>
          <id>repo2</id>
          <mirrorOf>central</mirrorOf>
          <url>https://repo1.maven.org/maven2/</url>
      </mirror>

      Add the following mirror warehouse address to the profiles in setting.xml.

      <profile>
          <id>huaweicloudsdk</id>
          <repositories>
              <repository>
                  <id>huaweicloudsdk</id>
                  <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
                  <releases><enabled>true</enabled></releases>
                  <snapshots><enabled>true</enabled></snapshots>
              </repository>
          </repositories>
      </profile>

      Add the following mirror warehouse address to the activeProfiles in setting.xml.

      <activeProfile>huaweicloudsdk</activeProfile>

      The HUAWEI CLOUD open source mirror center does not provide third-party open source JAR files. After configuring HUAWEI CLOUD open source mirrors, you need to separately configure third-party Maven image repository address.

    • Configuration method 2

      Add the following mirror warehouse address to the pom.xml file in the secondary development sample project.

          <repositories>
      
              <repository>
                  <id>huaweicloudsdk</id>
                  <url>https://mirrors.huaweicloud.com/repository/maven/huaweicloudsdk/</url>
                  <releases><enabled>true</enabled></releases>
                  <snapshots><enabled>true</enabled></snapshots>
              </repository>
      
              <repository>
                  <id>central</id>
                  <name>Mavn Centreal</name>
                  <url>https://repo1.maven.org/maven2/</url>
              </repository>
      
          </repositories>