peixue-dev/Archive/peidu-temp-files/scripts/🚀强制清理重新编译-2026-01-24.bat

97 lines
2.5 KiB
Batchfile
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
chcp 65001 >nul
echo ========================================
echo 强制清理重新编译 - 2026-01-24
echo ========================================
echo.
echo 这将解决"找不到符号"的编译错误
echo.
cd /d "%~dp0backend"
echo [步骤1/4] 删除target目录...
if exist target (
rmdir /s /q target
echo ✅ target目录已删除
) else (
echo target目录不存在
)
echo.
echo [步骤2/4] 清理Maven缓存...
call mvn clean -U
if errorlevel 1 (
echo ⚠️ 清理时出现警告,继续...
)
echo.
echo [步骤3/4] 重新编译项目...
echo 这可能需要几分钟,请耐心等待...
echo.
call mvn compile -DskipTests
if errorlevel 1 (
echo.
echo ========================================
echo ❌ 编译失败!
echo ========================================
echo.
echo 可能的原因:
echo 1. Maven缓存损坏 - 尝试删除 C:\Users\你的用户名\.m2\repository
echo 2. Java版本不匹配 - 检查 java -version
echo 3. 文件编码问题 - 确保所有文件是UTF-8编码
echo.
echo 请查看上面的错误信息,或联系技术支持
echo.
pause
exit /b 1
) else (
echo.
echo ========================================
echo ✅ 编译成功!
echo ========================================
echo.
echo 修复的问题:
echo - ✅ 清除了损坏的编译缓存
echo - ✅ 重新编译了所有Java文件
echo - ✅ 所有类都已正确生成
echo.
echo 编译产物位置: target\classes
echo.
echo [步骤4/4] 验证关键类文件...
echo.
if exist "target\classes\com\peidu\annotation\CurrentUser.class" (
echo ✅ CurrentUser.class 已生成
) else (
echo ❌ CurrentUser.class 未找到
)
if exist "target\classes\com\peidu\dto\OrderCreateDTO.class" (
echo ✅ OrderCreateDTO.class 已生成
) else (
echo ❌ OrderCreateDTO.class 未找到
)
if exist "target\classes\com\peidu\vo\OrderVO.class" (
echo ✅ OrderVO.class 已生成
) else (
echo ❌ OrderVO.class 未找到
)
if exist "target\classes\com\peidu\service\TeacherOnlineService.class" (
echo ✅ TeacherOnlineService.class 已生成
) else (
echo ❌ TeacherOnlineService.class 未找到
)
echo.
echo 下一步:
echo 1. 启动后端服务: mvn spring-boot:run
echo 2. 或打包部署: mvn package -DskipTests
echo.
)
pause