diff --git a/assembly/assembly.xml b/assembly/assembly.xml
index e80a788..45f13a7 100644
--- a/assembly/assembly.xml
+++ b/assembly/assembly.xml
@@ -48,7 +48,7 @@
-
+
${project.build.directory}/${project.artifactId}.jar
@@ -57,4 +57,14 @@
0644
+
+
+
+
+ lib
+ false
+ runtime
+ 0644
+
+
diff --git a/fund-cust/pom.xml b/fund-cust/pom.xml
index ee427fa..b0542a4 100644
--- a/fund-cust/pom.xml
+++ b/fund-cust/pom.xml
@@ -70,14 +70,7 @@
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- ${project.artifactId}
-
-
-
+
org.apache.maven.plugins
maven-assembly-plugin
diff --git a/fund-cust/src/main/resources/service.properties b/fund-cust/src/main/resources/service.properties
index c3c904f..4f09df8 100644
--- a/fund-cust/src/main/resources/service.properties
+++ b/fund-cust/src/main/resources/service.properties
@@ -6,6 +6,9 @@
# 服务名称
APP_NAME=fund-cust
+# 主类(启动入口)
+MAIN_CLASS=com.fundplatform.cust.CustApplication
+
# 实例名称(多租户场景使用,留空则默认等于APP_NAME)
INSTANCE_NAME=
diff --git a/fund-exp/pom.xml b/fund-exp/pom.xml
index 2fc42d7..6d25d7e 100644
--- a/fund-exp/pom.xml
+++ b/fund-exp/pom.xml
@@ -62,14 +62,7 @@
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- ${project.artifactId}
-
-
-
+
org.apache.maven.plugins
maven-assembly-plugin
diff --git a/fund-exp/src/main/resources/service.properties b/fund-exp/src/main/resources/service.properties
index 85e3001..9faef95 100644
--- a/fund-exp/src/main/resources/service.properties
+++ b/fund-exp/src/main/resources/service.properties
@@ -6,6 +6,9 @@
# 服务名称
APP_NAME=fund-exp
+# 主类(启动入口)
+MAIN_CLASS=com.fundplatform.exp.ExpApplication
+
# 实例名称(多租户场景使用,留空则默认等于APP_NAME)
INSTANCE_NAME=
diff --git a/fund-file/pom.xml b/fund-file/pom.xml
index b39feb6..c8bd335 100644
--- a/fund-file/pom.xml
+++ b/fund-file/pom.xml
@@ -68,14 +68,7 @@
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- ${project.artifactId}
-
-
-
+
org.apache.maven.plugins
maven-assembly-plugin
diff --git a/fund-file/src/main/resources/service.properties b/fund-file/src/main/resources/service.properties
index fd270e7..c1758f3 100644
--- a/fund-file/src/main/resources/service.properties
+++ b/fund-file/src/main/resources/service.properties
@@ -6,6 +6,9 @@
# 服务名称
APP_NAME=fund-file
+# 主类(启动入口)
+MAIN_CLASS=com.fundplatform.file.FileApplication
+
# 实例名称(留空则默认等于APP_NAME)
INSTANCE_NAME=
diff --git a/fund-gateway/pom.xml b/fund-gateway/pom.xml
index bd04243..b4f92ac 100644
--- a/fund-gateway/pom.xml
+++ b/fund-gateway/pom.xml
@@ -73,14 +73,7 @@
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- ${project.artifactId}
-
-
-
+
org.apache.maven.plugins
maven-assembly-plugin
diff --git a/fund-gateway/src/main/resources/service.properties b/fund-gateway/src/main/resources/service.properties
index 4d220af..74c75f3 100644
--- a/fund-gateway/src/main/resources/service.properties
+++ b/fund-gateway/src/main/resources/service.properties
@@ -6,6 +6,9 @@
# 服务名称
APP_NAME=fund-gateway
+# 主类(启动入口)
+MAIN_CLASS=com.fundplatform.gateway.GatewayApplication
+
# 实例名称(多租户场景使用,留空则默认等于APP_NAME)
INSTANCE_NAME=
diff --git a/fund-proj/pom.xml b/fund-proj/pom.xml
index edd6463..0208686 100644
--- a/fund-proj/pom.xml
+++ b/fund-proj/pom.xml
@@ -62,14 +62,7 @@
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- ${project.artifactId}
-
-
-
+
org.apache.maven.plugins
maven-assembly-plugin
diff --git a/fund-proj/src/main/resources/service.properties b/fund-proj/src/main/resources/service.properties
index cdfe502..57b4fbe 100644
--- a/fund-proj/src/main/resources/service.properties
+++ b/fund-proj/src/main/resources/service.properties
@@ -6,6 +6,9 @@
# 服务名称
APP_NAME=fund-proj
+# 主类(启动入口)
+MAIN_CLASS=com.fundplatform.proj.ProjApplication
+
# 实例名称(多租户场景使用,留空则默认等于APP_NAME)
INSTANCE_NAME=
diff --git a/fund-receipt/pom.xml b/fund-receipt/pom.xml
index bc487c8..70ff5ea 100644
--- a/fund-receipt/pom.xml
+++ b/fund-receipt/pom.xml
@@ -62,14 +62,7 @@
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- ${project.artifactId}
-
-
-
+
org.apache.maven.plugins
maven-assembly-plugin
diff --git a/fund-receipt/src/main/resources/service.properties b/fund-receipt/src/main/resources/service.properties
index 55ff338..b3d2097 100644
--- a/fund-receipt/src/main/resources/service.properties
+++ b/fund-receipt/src/main/resources/service.properties
@@ -6,6 +6,9 @@
# 服务名称
APP_NAME=fund-receipt
+# 主类(启动入口)
+MAIN_CLASS=com.fundplatform.receipt.ReceiptApplication
+
# 实例名称(多租户场景使用,留空则默认等于APP_NAME)
INSTANCE_NAME=
diff --git a/fund-report/pom.xml b/fund-report/pom.xml
index 2d2d3b5..dd1ca3b 100644
--- a/fund-report/pom.xml
+++ b/fund-report/pom.xml
@@ -67,14 +67,7 @@
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- ${project.artifactId}
-
-
-
+
org.apache.maven.plugins
maven-assembly-plugin
diff --git a/fund-report/src/main/resources/service.properties b/fund-report/src/main/resources/service.properties
index f935ca4..504b79c 100644
--- a/fund-report/src/main/resources/service.properties
+++ b/fund-report/src/main/resources/service.properties
@@ -6,6 +6,9 @@
# 服务名称
APP_NAME=fund-report
+# 主类(启动入口)
+MAIN_CLASS=com.fundplatform.report.ReportApplication
+
# 实例名称(留空则默认等于APP_NAME)
INSTANCE_NAME=
diff --git a/fund-req/pom.xml b/fund-req/pom.xml
index aff67cf..ae4c28f 100644
--- a/fund-req/pom.xml
+++ b/fund-req/pom.xml
@@ -62,14 +62,7 @@
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- ${project.artifactId}
-
-
-
+
org.apache.maven.plugins
maven-assembly-plugin
diff --git a/fund-req/src/main/resources/service.properties b/fund-req/src/main/resources/service.properties
index f7192bf..24fb13c 100644
--- a/fund-req/src/main/resources/service.properties
+++ b/fund-req/src/main/resources/service.properties
@@ -6,6 +6,9 @@
# 服务名称
APP_NAME=fund-req
+# 主类(启动入口)
+MAIN_CLASS=com.fundplatform.req.ReqApplication
+
# 实例名称(多租户场景使用,留空则默认等于APP_NAME)
INSTANCE_NAME=
diff --git a/fund-sys/pom.xml b/fund-sys/pom.xml
index fe0560b..02b8e39 100644
--- a/fund-sys/pom.xml
+++ b/fund-sys/pom.xml
@@ -109,15 +109,6 @@
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- ${project.artifactId}
-
-
-
org.apache.maven.plugins
diff --git a/fund-sys/src/main/resources/service.properties b/fund-sys/src/main/resources/service.properties
index 1f1fb11..1cfef70 100644
--- a/fund-sys/src/main/resources/service.properties
+++ b/fund-sys/src/main/resources/service.properties
@@ -6,6 +6,9 @@
# 服务名称(对应JAR文件名,用于Nacos服务注册)
APP_NAME=fund-sys
+# 主类(启动入口)
+MAIN_CLASS=com.fundplatform.sys.SysApplication
+
# 实例名称(多租户场景使用,留空则默认等于APP_NAME)
# 多租户示例:fund-sys-shared, fund-sys-vip001
INSTANCE_NAME=
diff --git a/pom.xml b/pom.xml
index 4f11f21..3b5d4f8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -103,4 +103,44 @@
+
+
+
+ ${project.artifactId}
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.3.0
+
+
+
+ true
+ lib/
+
+
+
+
+ **/*.yml
+ **/*.yaml
+ **/*.properties
+ **/*.xml
+ **/*.json
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ ${project.artifactId}
+
+ true
+
+
+
+
diff --git a/scripts/start.sh b/scripts/start.sh
index 776f8f3..71414e2 100755
--- a/scripts/start.sh
+++ b/scripts/start.sh
@@ -36,29 +36,36 @@ if [[ -z "${INSTANCE_NAME}" ]] || [[ "${INSTANCE_NAME}" == '\${APP_NAME}' ]]; th
fi
TENANT_ID=${TENANT_ID:-""}
-# 4. JAR文件路径(优先查找根目录的主JAR,再查找lib目录)
-# Spring Boot fat jar已包含所有依赖,主JAR在根目录
+# 4. 主JAR文件路径
JAR_FILE="${APP_HOME}/${APP_NAME}.jar"
if [ ! -f "$JAR_FILE" ]; then
- # fallback: 查找lib目录(兼容旧版打包结构)
- JAR_FILE=$(ls ${APP_HOME}/lib/${APP_NAME}*.jar 2>/dev/null | head -1)
-fi
-if [ ! -f "$JAR_FILE" ]; then
- # 最后尝试: lib目录任意jar(向后兼容)
- JAR_FILE=$(ls ${APP_HOME}/lib/*.jar 2>/dev/null | head -1)
-fi
-if [ -z "$JAR_FILE" ] || [ ! -f "$JAR_FILE" ]; then
- echo "Error: No JAR file found for ${APP_NAME}"
- echo " Searched: ${APP_HOME}/${APP_NAME}.jar"
- echo " Searched: ${APP_HOME}/lib/${APP_NAME}*.jar"
- echo " Searched: ${APP_HOME}/lib/*.jar"
+ echo "Error: No JAR file found: ${JAR_FILE}"
exit 1
fi
-# 5. 日志目录(使用INSTANCE_NAME区分不同实例)
+# 5. 主类(从service.properties读取,或使用默认值)
+MAIN_CLASS=${MAIN_CLASS:-""}
+if [ -z "$MAIN_CLASS" ]; then
+ echo "Error: MAIN_CLASS not configured in service.properties"
+ exit 1
+fi
+
+# 6. 构建ClassPath(lib目录所有jar + 主jar)
+# 检查lib目录是否存在
+if [ -d "${APP_HOME}/lib" ]; then
+ # 构建classpath: lib/* + 主JAR
+ CLASSPATH="${APP_HOME}/lib/*:${JAR_FILE}"
+ LAUNCH_MODE="classpath"
+else
+ # fallback: fat jar模式(向后兼容)
+ CLASSPATH="${JAR_FILE}"
+ LAUNCH_MODE="fatjar"
+fi
+
+# 7. 日志目录(使用INSTANCE_NAME区分不同实例)
LOG_HOME="/datacfs/applogs/${INSTANCE_NAME}"
-# 6. PID文件路径
+# 8. PID文件路径
PID_FILE="${APP_HOME}/${INSTANCE_NAME}.pid"
# JVM参数(可通过环境变量覆盖)
@@ -98,13 +105,22 @@ echo " APP_NAME: ${APP_NAME}"
echo " INSTANCE_NAME: ${INSTANCE_NAME}"
echo " APP_HOME: ${APP_HOME}"
echo " JAR_FILE: ${JAR_FILE}"
+echo " MAIN_CLASS: ${MAIN_CLASS}"
+echo " LAUNCH_MODE: ${LAUNCH_MODE}"
echo " LOG_HOME: ${LOG_HOME}"
echo " JAVA_OPTS: ${JAVA_OPTS}"
if [ -n "${TENANT_ID}" ]; then
echo " TENANT_ID: ${TENANT_ID}"
fi
-nohup java $JAVA_OPTS $LOG_OPTS $TENANT_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
+# 根据启动模式选择启动方式
+if [ "$LAUNCH_MODE" == "classpath" ]; then
+ # ClassPath模式:java -cp lib/*:app.jar MainClass
+ nohup java $JAVA_OPTS $LOG_OPTS $TENANT_OPTS -cp "$CLASSPATH" $MAIN_CLASS $CONFIG_OPTS > /dev/null 2>&1 &
+else
+ # FatJar模式:java -jar app.jar(向后兼容)
+ nohup java $JAVA_OPTS $LOG_OPTS $TENANT_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
+fi
# 保存PID
echo $! > $PID_FILE