Preparations

Preparing a Development Environment

  • JDK 1.8 or later has been installed and the environment has been configured. For details about how to install the JDK, see JDK Installation.
  • Maven has been downloaded and installed.
  • Development environments such as Eclipse have been prepared.

Installing and Configuring Maven

Download the settings.xml file and overwrite the file with the same name in the Maven installation directory/conf/ directory. If you do not want to overwrite the configuration file, perform the following steps to modify the settings.xml file:

  1. Add the following content to the profiles node:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    <profile>   
       <id>MyProfile</id>  
       <repositories>      
         <repository>         
           <id>HuaweiCloudSDK</id>          
           <url>https://mirrors.huaweicloud.com/repository/maven/huaweicloudsdk/</url>          
         <releases>               
            <enabled>true</enabled>           
         </releases>           
         <snapshots>              
         <enabled>false</enabled>            
         </snapshots>       
         </repository>    
       </repositories>   
    
       <pluginRepositories>        
          <pluginRepository>            
             <id>HuaweiCloudSDK</id>           
             <url>https://mirrors.huaweicloud.com/repository/maven/huaweicloudsdk/</url>          
             <releases>                
             <enabled>true</enabled>           
             </releases>          
             <snapshots>               
             <enabled>false</enabled>         
             </snapshots>      
           </pluginRepository>   
     </pluginRepositories>
    </profile>
    
  2. Add the following information to the mirrors node:
    1
    2
    3
    4
    5
    <mirror>    
       <id>huaweicloud</id>   
       <mirrorOf>*,!HuaweiCloudSDK</mirrorOf>    
       <url>https://mirrors.huaweicloud.com/repository/maven/</url>
    </mirror>
    
  3. Add the activeProfiles tag to activate the configurations.
    1
    2
    3
    <activeProfiles>    
        <activeProfile>MyProfile</activeProfile>
    </activeProfiles>
    
  4. Add the SDK dependencies of MPC to the pom.xml file. You can view the latest SDK version of MPC at the Huawei open-source image site.
    1
    2
    3
    4
    5
    6
    7
    <dependencies>
      <dependency>
          <groupId>com.huawei.mpc</groupId>
          <artifactId>cloud-java-sdk-mpc</artifactId>
          <version>${mpc-sdk-version}</version>
       </dependency>
    </dependencies>