#!/bin/bash echo "=== 验证后端模块启动状态 ===" modules=( "emotion-auth:19003" "emotion-record:19004" "emotion-growth:19005" "emotion-explore:19006" "emotion-reward:19007" "emotion-stats:19008" "emotion-common:无端口" ) for module_info in "${modules[@]}"; do module=$(echo $module_info | cut -d: -f1) port=$(echo $module_info | cut -d: -f2) echo "--- 验证模块: $module ---" if [ ! -d "$module" ]; then echo "❌ 模块目录不存在: $module" continue fi cd $module # 检查是否有主类 if [ "$module" = "emotion-common" ]; then echo "✅ emotion-common 是公共模块,无需启动" cd .. continue fi # 尝试编译 echo "编译模块..." mvn compile -q if [ $? -ne 0 ]; then echo "❌ 编译失败: $module" cd .. continue fi # 检查主类是否存在 main_class_found=$(find src/main/java -name "*Application.java" | wc -l) if [ $main_class_found -eq 0 ]; then echo "❌ 未找到主类: $module" cd .. continue fi echo "✅ 模块 $module 编译成功,具有主类" cd .. done echo "=== 验证完成 ==="