Skip to content

Commit

Permalink
fix: assemble executable jar for pd and store (#2289)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
VGalaxies and imbajin authored Aug 29, 2023
1 parent d6a2548 commit c70a294
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion hugegraph-pd/hg-pd-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion hugegraph-pd/hg-pd-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -25,7 +27,6 @@
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;
Expand Down
1 change: 1 addition & 0 deletions hugegraph-store/hg-store-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 11 additions & 6 deletions hugegraph-store/hg-store-node/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>

Expand All @@ -168,6 +172,7 @@
<mainClass>
org.apache.hugegraph.store.node.StoreNodeApplication
</mainClass>
<includeSystemScope>true</includeSystemScope>
</configuration>
</execution>
</executions>
Expand Down

0 comments on commit c70a294

Please sign in to comment.