@echo off title Daily Report Distribution - Local Start echo ========================================== echo Daily Report Distribution - Local Start echo ========================================== echo. echo [1/5] Checking port status... netstat -ano | findstr ":37821.*LISTENING" >nul if %errorlevel% equ 0 ( echo [WARN] Port 37821 is in use, trying to stop... for /f "tokens=5" %%a in ('netstat -ano ^| findstr ":37821.*LISTENING"') do taskkill /PID %%a /F >nul 2>&1 ) else ( echo [OK] Port 37821 is available ) echo. echo [2/5] Building backend JAR (this ensures latest code)... set "JAVA_HOME=C:\Program Files\Java\jdk-21.0.11" set "PATH=%JAVA_HOME%\bin;%PATH%" call mvnw.cmd package -DskipTests -q if %errorlevel% neq 0 ( echo [ERROR] Build failed! pause exit /b 1 ) echo [OK] Build complete echo. echo [3/5] Starting backend Spring Boot (port 37821)... set "JAVA_HOME=C:\Program Files\Java\jdk-21.0.11" set "PATH=%JAVA_HOME%\bin;%PATH%" start "Backend [37821]" /min cmd /c "cd /d ""%~dp0"" && java.exe -jar target\daily-report-distribution-1.0.0.jar" echo Waiting for backend to start (10s)... timeout /t 10 /nobreak >nul echo [OK] Backend launched echo. echo [4/5] Starting frontend Vite Dev Server (port 41733)... start "Frontend [41733]" /min cmd /c "cd /d ""%~dp0"" && npm run dev" echo. echo [5/5] Starting frontend E2E server (port 41735)... start "E2E Server [41735]" /min cmd /c "cd /d ""%~dp0"" && npm run dev -- --port 41735" echo. echo ========================================== echo Done! echo ========================================== echo. echo Backend: http://localhost:37821 echo Frontend: http://localhost:41733 echo E2E: http://localhost:41735 echo. echo Minimize these windows - keep them running echo ========================================== echo. pause