Updated on 2024-06-21 GMT+08:00

Downloading a Sample Project

Prerequisites

Ensure that CloudTable has been installed and is running properly.

Downloading a Sample Project

  1. Download the Sample Code project.
  2. After the download is complete, decompress the installation package of the sample code project to a local directory to obtain an Eclipse Java project. Figure 1 shows the directory structure of the sample code project.

    Figure 1 Directory structure of the sample code project

Apache Maven Configuration

The sample project contains the HBase client JAR package. You can replace the JAR package with an open source HBase JAR package to access CloudTable. Open source HBase APIs later than 1.X.X are supported. If you need to import CloudTable's HBase JAR package to an application, configure the following dependencies in Maven:

<dependencies>
    <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>hbase-client</artifactId>
        <version>1.3.1.0305-cloudtable</version>
    </dependency>
    <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>hbase-common</artifactId>
        <version>1.3.1.0305-cloudtable</version>
    </dependency>
</dependencies>
Use either of the following methods to configure the address of the mirror warehouse.
  • Configuration method 1

    Add the address of the open source mirror warehouse to the mirrors in setting.xml.

    <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>