@echo off
REM CMD Maven Environment Switch - {{env_name}}
REM Generated by fnva

REM Set new MAVEN_HOME / M2_HOME
set "MAVEN_HOME={{escape_backslash maven_home}}"
set "M2_HOME={{escape_backslash maven_home}}"

REM Set fnva environment tracking
set "FNVA_CURRENT_MAVEN={{env_name}}"
set "FNVA_ENV_TYPE=Maven"

REM Update PATH to include Maven bin
if defined FNVA_MAVEN_BIN call set "PATH=%%PATH:%FNVA_MAVEN_BIN%;=%%"
set "FNVA_MAVEN_BIN={{escape_backslash maven_bin}}"
set "PATH=%FNVA_MAVEN_BIN%;%PATH%"

REM Set MAVEN_OPTS (clear previous then apply this environment's config)
{{#if has_maven_opts}}
set "MAVEN_OPTS={{maven_opts_value}}"
{{else}}
set "MAVEN_OPTS="
{{/if}}

REM Verify the switch
echo ✓ Switched to Maven: {{env_name}}
