From c70a2944b07f6ec31a751beee26cd0e4df93f876 Mon Sep 17 00:00:00 2001 From: V_Galaxy Date: Tue, 29 Aug 2023 18:43:36 +0800 Subject: [PATCH] fix: assemble executable jar for pd and store (#2289) Due to the change of hugegraph-pd's parent from spring-boot-starter-parent to hugegraph, and hugegraph's parent being apache, along with modifications to the artifactId of certain sub-modules (for example, hugegraph-pd to hg-pd-service), the following steps need to be taken: Modify the descriptor of the maven-assembly-plugin, which involves adjusting the collected jar package names accordingly. - Update the corresponding jar package names in the startup script. - Since hugegraph-pd is started using Spring Boot, the spring-boot-maven-plugin needs to be reconfigured. --------- Co-authored-by: imbajin --- hugegraph-pd/hg-pd-dist/pom.xml | 2 +- .../assembly/static/bin/start-hugegraph-pd.sh | 4 ++-- hugegraph-pd/hg-pd-service/pom.xml | 11 ++++++++++- .../org/apache/hugegraph/pd/rest/IndexAPI.java | 3 ++- hugegraph-store/hg-store-dist/pom.xml | 1 + .../src/assembly/descriptor/server-assembly.xml | 4 ++-- .../static/bin/start-hugegraph-store.sh | 2 +- hugegraph-store/hg-store-node/pom.xml | 17 +++++++++++------ 8 files changed, 30 insertions(+), 14 deletions(-) diff --git a/hugegraph-pd/hg-pd-dist/pom.xml b/hugegraph-pd/hg-pd-dist/pom.xml index 58cd86250..3cb51b393 100644 --- a/hugegraph-pd/hg-pd-dist/pom.xml +++ b/hugegraph-pd/hg-pd-dist/pom.xml @@ -36,7 +36,7 @@ ${assembly.dir}/descriptor ${assembly.dir}/static hugegraph-pd-${project.parent.version} - hugegraph-pd + hg-pd-service diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh index df44dd107..05b3921c7 100644 --- a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh +++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh @@ -114,8 +114,8 @@ fi echo "Starting HugeGraphPDServer..." # Turn on security check -exec ${JAVA} ${JAVA_OPTIONS} -jar -Dspring.config.location=${CONF}/application.yml \ - ${LIB}/hugegraph-pd-*.jar >> ${OUTPUT} 2>&1 & +exec ${JAVA} -Dname="HugeGraphPD" ${JAVA_OPTIONS} -jar \ + -Dspring.config.location=${CONF}/application.yml ${LIB}/hg-pd-service-*.jar >> ${OUTPUT} 2>&1 & PID="$!" # Write pid to file diff --git a/hugegraph-pd/hg-pd-service/pom.xml b/hugegraph-pd/hg-pd-service/pom.xml index e7f51323c..ca2e68d94 100644 --- a/hugegraph-pd/hg-pd-service/pom.xml +++ b/hugegraph-pd/hg-pd-service/pom.xml @@ -120,6 +120,12 @@ org.apache.hugegraph hugegraph-common 1.0.1 + + + org.apache.logging.log4j + log4j-api + + commons-io @@ -138,11 +144,14 @@ - spring-boot org.apache.hugegraph.pd.boot.HugePDServer + + + repackage + diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java index 0d0cebb3e..6b1113a2e 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java @@ -15,6 +15,8 @@ * under the License. */ +package org.apache.hugegraph.pd.rest; + import java.lang.management.ManagementFactory; import java.util.ArrayList; import java.util.List; @@ -25,7 +27,6 @@ import org.apache.hugegraph.pd.grpc.Metapb; import org.apache.hugegraph.pd.grpc.Pdpb; import org.apache.hugegraph.pd.model.RestApiResponse; import org.apache.hugegraph.pd.raft.RaftEngine; -import org.apache.hugegraph.pd.rest.API; import org.apache.hugegraph.pd.rest.MemberAPI.CallStreamObserverWrap; import org.apache.hugegraph.pd.service.PDRestService; import org.apache.hugegraph.pd.service.PDService; diff --git a/hugegraph-store/hg-store-dist/pom.xml b/hugegraph-store/hg-store-dist/pom.xml index 5d8030e08..9c548e061 100644 --- a/hugegraph-store/hg-store-dist/pom.xml +++ b/hugegraph-store/hg-store-dist/pom.xml @@ -38,6 +38,7 @@ ${assembly.dir}/descriptor ${assembly.dir}/static hugegraph-store-${revision} + hg-store-node diff --git a/hugegraph-store/hg-store-dist/src/assembly/descriptor/server-assembly.xml b/hugegraph-store/hg-store-dist/src/assembly/descriptor/server-assembly.xml index 44001cffb..79dd4cdd0 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/descriptor/server-assembly.xml +++ b/hugegraph-store/hg-store-dist/src/assembly/descriptor/server-assembly.xml @@ -51,9 +51,9 @@ runtime false - org.apache.hugegraph:hugegraph-store:jar:* + org.apache.hugegraph:${executable.jar.name}:jar:* - \ No newline at end of file + diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh index 242c41791..4bf1e8534 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh +++ b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh @@ -158,7 +158,7 @@ echo "Starting HG-StoreServer..." exec ${JAVA} -Dname="HugeGraphStore" ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar \ -Dspring.config.location=${CONF}/application.yml \ - ${LIB}/hugegraph-store-*.jar >> ${OUTPUT} 2>&1 & + ${LIB}/hg-store-node-*.jar >> ${OUTPUT} 2>&1 & PID="$!" # Write pid to file diff --git a/hugegraph-store/hg-store-node/pom.xml b/hugegraph-store/hg-store-node/pom.xml index bed0566ab..22bffb49c 100644 --- a/hugegraph-store/hg-store-node/pom.xml +++ b/hugegraph-store/hg-store-node/pom.xml @@ -43,11 +43,6 @@ - - org.springframework.boot - spring-boot-starter-log4j2 - 2.5.14 - org.springframework.boot spring-boot-starter-actuator @@ -149,7 +144,16 @@ 3.6.4 - + + org.apache.logging.log4j + log4j-core + 2.17.2 + + + org.apache.logging.log4j + log4j-api + 2.17.2 + @@ -168,6 +172,7 @@ org.apache.hugegraph.store.node.StoreNodeApplication + true