@echo off REM =========================================================================== REM rebuild-jar.bat - Rebuild StudioBridge.jar from source and deploy it to REM the portable-dist folder. REM REM Requirements: REM - Apache Maven (auto-located from %LOCALAPPDATA%\Programs\apache-maven-*) REM - A JDK/JRE with javac (uses the bundled one in ..\portable-dist\jre) REM =========================================================================== setlocal cd /d "%~dp0" REM --- Locate Maven ---------------------------------------------------------- set "MAVEN_CMD=" for /d %%D in ("%LOCALAPPDATA%\Programs\apache-maven-*") do ( if exist "%%D\bin\mvn.cmd" set "MAVEN_CMD=%%D\bin\mvn.cmd" ) if not defined MAVEN_CMD ( echo ERROR: Maven not found. Install it or set MAVEN_CMD manually. pause exit /b 1 ) REM --- Use the bundled JDK/JRE for building --------------------------------- set "JAVA_HOME=%~dp0..\portable-dist\jre" if not exist "%JAVA_HOME%\bin\javac.exe" ( echo ERROR: No compiler found in "%JAVA_HOME%". pause exit /b 1 ) echo [BUILD] Using Maven : %MAVEN_CMD% echo [BUILD] Using JAVA_HOME : %JAVA_HOME% echo. REM --- Build ---------------------------------------------------------------- call "%MAVEN_CMD%" -f pom.xml clean package if errorlevel 1 ( echo. echo ERROR: Maven build failed. pause exit /b 1 ) REM --- Deploy the fat jar to portable-dist ---------------------------------- set "JAR_VERSION=2.1.3" set "BUILT=target\StudioBridge-%JAR_VERSION%-jar-with-dependencies.jar" set "DEST=..\portable-dist\StudioBridge-%JAR_VERSION%.jar" if not exist "%BUILT%" ( echo ERROR: Build output not found: %BUILT% pause exit /b 1 ) copy /Y "%BUILT%" "%DEST%" >nul if errorlevel 1 ( echo ERROR: Could not copy jar to %DEST% pause exit /b 1 ) echo. echo [OK] Rebuilt and deployed: %DEST% endlocal