@echo off
set JAVA_HOME=C:\Program Files\Java\jdk-21.0.8
set PATH=%JAVA_HOME%\bin;%PATH%

echo Starting Maven build...
echo JAVA_HOME=%JAVA_HOME%
echo PATH=%PATH%

:: Check if maven wrapper properties exist
if not exist ".mvn\wrapper\maven-wrapper.properties" (
    echo ERROR: .mvn\wrapper\maven-wrapper.properties not found!
    pause
    exit /b 1
)

:: Try to run maven directly
echo Running: mvn clean package -DskipTests
mvn clean package -DskipTests

if %ERRORLEVEL% equ 0 (
    echo Build successful!
    echo JAR file should be in target/ directory
) else (
    echo Build failed with error code %ERRORLEVEL%
)

pause