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 <jin@apache.org>
This commit is contained in:
V_Galaxy 2023-08-29 18:43:36 +08:00 committed by GitHub
parent d6a2548427
commit c70a2944b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 14 deletions

View File

@ -36,7 +36,7 @@
<assembly.descriptor.dir>${assembly.dir}/descriptor</assembly.descriptor.dir>
<assembly.static.dir>${assembly.dir}/static</assembly.static.dir>
<final.name>hugegraph-pd-${project.parent.version}</final.name>
<executable.jar.name>hugegraph-pd</executable.jar.name>
<executable.jar.name>hg-pd-service</executable.jar.name>
</properties>
<dependencies>

View File

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

View File

@ -120,6 +120,12 @@
<groupId>org.apache.hugegraph</groupId>
<artifactId>hugegraph-common</artifactId>
<version>1.0.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-io</groupId>
@ -138,11 +144,14 @@
<executions>
<execution>
<configuration>
<classifier>spring-boot</classifier>
<mainClass>
org.apache.hugegraph.pd.boot.HugePDServer
</mainClass>
</configuration>
<!-- should configure explicitly without spring-boot-starter-parent -->
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>

View File

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

View File

@ -38,6 +38,7 @@
<assembly.descriptor.dir>${assembly.dir}/descriptor</assembly.descriptor.dir>
<assembly.static.dir>${assembly.dir}/static</assembly.static.dir>
<final.name>hugegraph-store-${revision}</final.name>
<executable.jar.name>hg-store-node</executable.jar.name>
</properties>
<dependencies>
<dependency>

View File

@ -51,9 +51,9 @@
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>org.apache.hugegraph:hugegraph-store:jar:*</include>
<include>org.apache.hugegraph:${executable.jar.name}:jar:*</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>
</assembly>

View File

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

View File

@ -43,11 +43,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<version>2.5.14</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
@ -149,7 +144,16 @@
<version>3.6.4</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.2</version>
</dependency>
<!-- module end -->
</dependencies>
@ -168,6 +172,7 @@
<mainClass>
org.apache.hugegraph.store.node.StoreNodeApplication
</mainClass>
<includeSystemScope>true</includeSystemScope>
</configuration>
</execution>
</executions>