| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- @echo off
- chcp 65001 >nul
- setlocal EnableDelayedExpansion
- set "FRONTEND_DIR=frontend"
- set "BACKEND_DIR=backend"
- echo ========================================
- echo 知识库管理系统 - 合并构建部署工具
- echo ========================================
- echo.
- if "%~1"=="build" (
- echo [模式] 仅构建(不启动服务)
- call :build
- echo.
- echo [完成] 构建成功!使用 java -jar %BACKEND_DIR%\target\knowledge-extractor.jar 运行
- goto :eof
- )
- if "%~1"=="" (
- echo [模式] 构建 + 启动
- call :build
- echo.
- echo [启动] 正在启动后端服务(端口 7945)...
- cd %BACKEND_DIR%
- mvn spring-boot:run -q
- goto :eof
- )
- if "%~1"=="db" (
- echo [模式] 初始化数据库(执行 schema.sql)
- echo 请确认 application.yml 中的数据库连接信息
- cd %BACKEND_DIR%
- mvn -q exec:java -Dexec.mainClass="com.knowledge.extractor.KnowledgeExtractorApplication" -Dexec.args="--init-db"
- goto :eof
- )
- echo [用法]
- echo run.bat 构建 + 运行(端口 7945)
- echo run.bat build 仅构建
- goto :eof
- :build
- echo ---- [1/2] 前端打包(直接输出到后端 static 目录)----
- cd %FRONTEND_DIR%
- call npm run build
- if errorlevel 1 (
- echo [错误] 前端打包失败!
- exit /b 1
- )
- cd ..
- echo ---- [2/2] 后端打包 ----
- cd %BACKEND_DIR%
- call mvn package -DskipTests -q
- if errorlevel 1 (
- echo [错误] 后端打包失败!
- cd ..
- exit /b 1
- )
- cd ..
- echo ---- 构建完成 ----
- goto :eof
|