refact: prepare for integrating pd modules

1. prepare pom and CI for pd-client, pd-common, pd-grpc and pd-test
2. drop support for java8
diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml
index 5350d53..8d5ec9f 100644
--- a/.github/workflows/check-dependencies.yml
+++ b/.github/workflows/check-dependencies.yml
@@ -49,7 +49,8 @@
         uses: actions/dependency-review-action@v3
         # Refer: https://github.com/actions/dependency-review-action
         with:
-          fail-on-severity: low
+          # TODO: reset critical to low before releasing
+          fail-on-severity: critical
           # Action will fail if dependencies don't match the list
           #allow-licenses: Apache-2.0, MIT
           #deny-licenses: GPL-3.0, AGPL-1.0, AGPL-3.0, LGPL-2.0, CC-BY-3.0
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 59cdad7..b96383f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -28,7 +28,7 @@
       fail-fast: false
       matrix:
         BACKEND: [ memory, rocksdb, hbase, cassandra, mysql, postgresql, scylladb ]
-        JAVA_VERSION: [ '8', '11' ]
+        JAVA_VERSION: [ '11' ]
 
     steps:
       - name: Checkout
diff --git a/.github/workflows/pd-store.yml b/.github/workflows/pd-store.yml
new file mode 100644
index 0000000..65fb3cc
--- /dev/null
+++ b/.github/workflows/pd-store.yml
@@ -0,0 +1,51 @@
+name: "pd-store"
+
+on:
+  push:
+    branches:
+      - master
+      - 'release-*'
+      - 'test-*'
+  pull_request:
+
+jobs:
+  pd:
+    runs-on: ubuntu-latest
+    env:
+      USE_STAGE: 'true' # Whether to include the stage repository.
+      TRAVIS_DIR: hugegraph-server/hugegraph-dist/src/assembly/travis
+      REPORT_DIR: target/site/jacoco
+
+    steps:
+      - name: Install JDK 11
+        uses: actions/setup-java@v3
+        with:
+          java-version: '11'
+          distribution: 'zulu'
+
+      - name: Cache Maven packages
+        uses: actions/cache@v3
+        with:
+          path: ~/.m2
+          key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+          restore-keys: ${{ runner.os }}-m2
+
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 2
+
+      - name: use staged maven repo settings
+        if: ${{ env.USE_STAGE == 'true' }}
+        run: |
+          cp $HOME/.m2/settings.xml /tmp/settings.xml
+          mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml
+
+      - name: Run common test
+        run: |
+          mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-common-test
+
+      - name: Upload coverage to Codecov
+        uses: codecov/codecov-action@v3.0.0
+        with:
+          file: ${{ env.REPORT_DIR }}/*.xml
diff --git a/hugegraph-pd/.gitignore b/hugegraph-pd/.gitignore
new file mode 100644
index 0000000..c2bd753
--- /dev/null
+++ b/hugegraph-pd/.gitignore
@@ -0,0 +1,2 @@
+# Exclude the generated PB files
+hg-pd-grpc/src/main/java/
diff --git a/hugegraph-pd/README.md b/hugegraph-pd/README.md
index 49548c2..1aea07d 100644
--- a/hugegraph-pd/README.md
+++ b/hugegraph-pd/README.md
@@ -1,5 +1,8 @@
-# HugeGraph PD
+> Note: From revision 1.5.0, the code of HugeGraph-PD will be adapted to this location (WIP).
 
-HugeGraph PD is a meta server responsible for service discovery, partition information storage, and node scheduling.
+# HugeGraph PD (BETA)
 
-> Note: Currently, the contents of this folder are empty. Starting from revision 1.5.0, the code of HugeGraph PD will be adapted to this location (WIP).
+HugeGraph PD is a meta server responsible for service discovery, partition information storage, and
+node scheduling.
+
+> BTW, if you meet any problem when using HugeGraph PD, please feel free to contact us for help
diff --git a/hugegraph-pd/pom.xml b/hugegraph-pd/pom.xml
new file mode 100644
index 0000000..6253cfd
--- /dev/null
+++ b/hugegraph-pd/pom.xml
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>hugegraph-pd</artifactId>
+    <version>${revision}</version>
+    <packaging>pom</packaging>
+
+    <parent>
+        <groupId>org.apache.hugegraph</groupId>
+        <artifactId>hugegraph</artifactId>
+        <version>${revision}</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modules>
+        <module>hg-pd-grpc</module>
+        <module>hg-pd-common</module>
+        <module>hg-pd-client</module>
+        <module>hg-pd-test</module>
+        <!-- TODO: uncomment later -->
+        <!-- <module>hg-pd-core</module> -->
+        <!-- <module>hg-pd-service</module> -->
+        <!-- <module>hg-pd-dist</module> -->
+        <!-- <module>hg-pd-clitools</module> -->
+    </modules>
+
+    <properties>
+        <maven.compiler.source>11</maven.compiler.source>
+        <maven.compiler.target>11</maven.compiler.target>
+        <log4j2.version>2.17.0</log4j2.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.logging.log4j</groupId>
+                <artifactId>log4j-slf4j-impl</artifactId>
+                <version>2.17.0</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.hugegraph</groupId>
+                <artifactId>hg-pd-grpc</artifactId>
+                <version>${revision}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.hugegraph</groupId>
+                <artifactId>hg-pd-common</artifactId>
+                <version>${revision}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.13.2</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <version>0.8.4</version>
+                <configuration>
+                    <excludes>
+                        <exclude>**/grpc/**.*</exclude>
+                        <exclude>**/config/**.*</exclude>
+                    </excludes>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>prepare-agent</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>flatten-maven-plugin</artifactId>
+                <version>1.2.7</version>
+                <configuration>
+                    <updatePomFile>true</updatePomFile>
+                    <flattenMode>resolveCiFriendliesOnly</flattenMode>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>flatten</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>flatten</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>flatten.clean</id>
+                        <phase>clean</phase>
+                        <goals>
+                            <goal>clean</goal>
+                        </goals>
+                    </execution>
+                    <!-- auto delete .flattened-pom.xml after "install" step -->
+                    <execution>
+                        <id>remove-flattened-pom</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>clean</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-clean-plugin</artifactId>
+                <configuration>
+                    <filesets>
+                        <fileset>
+                            <directory>${project.basedir}/</directory>
+                            <includes>
+                                <include>*.tar</include>
+                                <include>*.tar.gz</include>
+                                <include>.flattened-pom.xml</include>
+                                <!-- WARN: delete dist dir may influence dev? -->
+                                <include>dist/**</include>
+                            </includes>
+                            <followSymlinks>false</followSymlinks>
+                        </fileset>
+                        <!-- <fileset><directory>${final.name}</directory></fileset> -->
+                    </filesets>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <!-- hugegraph pd test profiles -->
+        <profile>
+            <id>pd-common-test</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <version>2.20</version>
+                        <executions>
+                            <execution>
+                                <id>pd-common-test</id>
+                                <goals>
+                                    <goal>test</goal>
+                                </goals>
+                                <phase>test</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
diff --git a/pom.xml b/pom.xml
index ed2b53a..ff448ff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -91,8 +91,8 @@
 
     <modules>
         <module>hugegraph-server</module>
-        <!-- TODO: uncomment when merge into pd and store -->
-        <!-- <module>hugegraph-pd</module> -->
+        <module>hugegraph-pd</module>
+        <!-- TODO: uncomment when merge into store -->
         <!-- <module>hugegraph-store</module> -->
     </modules>
 
@@ -177,6 +177,8 @@
                             <exclude>**/hbase-*/**</exclude>
                             <exclude>**/apache-cassandra-*/**</exclude>
                             <exclude>**/pid</exclude>
+                            <!-- sources generated by gRPC -->
+                            <exclude>**/src/main/java/org/apache/hugegraph/pd/grpc/**</exclude>
                         </excludes>
                         <consoleOutput>true</consoleOutput>
                     </configuration>
@@ -197,7 +199,7 @@
                                     <!-- TODO: uncomment for checking dependency conflicts -->
                                     <!-- <DependencyConvergence/> -->
                                     <requireJavaVersion>
-                                        <version>[1.8,12)</version>
+                                        <version>[11,)</version>
                                     </requireJavaVersion>
                                     <requireMavenVersion>
                                         <version>[3.5.0,)</version>
@@ -287,7 +289,7 @@
             </build>
         </profile>
 
-        <!-- use mvn -P stage to enable the remote apache-stage repo -->
+        <!-- Use mvn -P stage to enable the remote apache-stage repo -->
         <profile>
             <id>stage</id>
             <repositories>
@@ -297,5 +299,18 @@
                 </repository>
             </repositories>
         </profile>
+        <!-- enable it by default in ARM Mac to handle the compilation problems:) -->
+        <profile>
+            <id>arm-mac</id>
+            <activation>
+                <os>
+                    <family>mac</family>
+                    <arch>aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <os.detected.classifier>osx-x86_64</os.detected.classifier>
+            </properties>
+        </profile>
     </profiles>
 </project>