Updated on 2024-02-02 GMT+08:00

Preparing the Development Environment

Preparing the Environment

Table 1 describes the preparations required before using LakeFormation Java SDK.

Table 1 Environment requirements

Item

Description

Java JDK environment

The Java environment is required and the Java version must be JDK 1.8 or later.

IntelliJ IDEA

Tool used for developing applications. The version must be 2019.1 or other compatible versions.

NOTE:
  • If you are using an IBM JDK, ensure that the JDK configured in IntelliJ IDEA is the IBM JDK.
  • If you are using an Oracle JDK, ensure that the JDK configured in IntelliJ IDEA is the Oracle JDK.
  • If you are using an open JDK, ensure that the JDK configured in IntelliJ IDEA is the Open JDK.
  • Do not use the same workspace and the sample project in the same path for different IntelliJ IDEA projects.

Maven installation

Basic configuration of the development environment. This tool is used for project management throughout the lifecycle of software development.

7-Zip

This tool is used to decompress .zip and .rar packages.

The 7-Zip 16.04 version is supported.

Collecting Dependency Information

  • Collecting LakeFormation Java SDK dependencies

    View the JAR package of LakeFormation Java SDK of the latest version in the Maven repository at Maven SDK address and obtain the file content. The following is an example.

            <dependency>
                <groupId>com.huaweicloud.sdk</groupId>
                <artifactId>huaweicloud-sdk-lakeformation</artifactId>
                <version>3.1.45</version>
            </dependency>

  • Preparing maven-assembly-plugin dependencies

    Prepare the following maven-assembly-plugin dependencies in advance:

        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.3.0</version>
                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                            <manifest>
                                <mainClass>com.huawei.cloud.dalf.lakecat.examples.CatalogExample</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                    <executions>
                        <execution>
                            <id>make-assembly</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>

Configuring IntelliJ IDEA and POM Files

  1. After the IntelliJ IDEA and JDK tools are installed, configure the JDK in IntelliJ IDEA.

    1. Start IntelliJ IDEA and choose Configure.
      Figure 1 Quick Start page
    2. Select Structure for New Projects from the drop-down list.
      Figure 2 Clicking Configure
    3. On the displayed Project Structure for New Projects page, select SDKs, click the plus sign (+), and click JDK.
      Figure 3 Project Structure for New Projects
    4. On the Select Home Directory for JDK page that is displayed, select the JDK directory and click OK.
      Figure 4 Select Home Directory for JDK
    5. After selecting the JDK, click OK to complete the configuration.
      Figure 5 Completing the configuration

    The operation procedure may vary according to the IDEA version.

  2. Set the Maven version used by the project.

    1. Choose File > Settings... from the main menu of IntelliJ IDEA.
      Figure 6 Settings
    2. Choose Build, Execution, Deployment > Maven and set Maven home directory to the Maven version installed on the local PC.
      Set User settings file and Local repository as you need, and click Apply > OK.
      Figure 7 Selecting the local Maven installation directory

  3. Set the IntelliJ IDEA text file coding format to prevent garbled characters.

    1. Choose File > Settings... from the main menu of IntelliJ IDEA.
      Figure 8 Settings
    2. In the navigation tree of the Settings page, choose Editor > File Encodings, and select UTF-8 for both Global Encoding and Project Encoding.
      Figure 9 File Encodings
    3. Click Apply and OK to complete the configuration.

  4. Add the LakeFormation Java SDK dependencies collected in Collecting Dependency Information and the maven-assembly-plugin dependencies to the end of the pom.xml file of Maven.