You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tim Reilly (JIRA)" <ji...@codehaus.org> on 2007/05/17 19:19:58 UTC

[jira] Closed: (MNG-2990) M2_HOME is incorrect when launched from another process

     [ http://jira.codehaus.org/browse/MNG-2990?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Reilly closed MNG-2990.
---------------------------

    Resolution: Duplicate

Sorry, did something naughty to get my jira session back-  but ended up duplicated the posts for 
MNG-2989

> M2_HOME is incorrect when launched from another process
> -------------------------------------------------------
>
>                 Key: MNG-2990
>                 URL: http://jira.codehaus.org/browse/MNG-2990
>             Project: Maven 2
>          Issue Type: Improvement
>          Components: Command Line
>    Affects Versions: 2.0.6
>         Environment: WinXP
>            Reporter: Tim Reilly
>            Priority: Minor
>
> This is just an idea to solve the following:  I believe echo'ing ~dp0 when launching maven.bat from ant exec produces the ant.bat processes ~0; not the maven bat  files ~0 -since createProc API is used the processes command is the first argument.
> I think you may get around this by putting a new "finder file" .bat along side mvn.bat . Since mvn.bat and find_m2.bat are both on the path I can "discover" where M2_HOME is from the %PATH%.
> Within mvn.bat
> if  "%m2_home%" == ""(
>    if "%OS%"=="Windows_NT" (call find_m2.bat)
> ) 
> Within find_m2.bat:
> @echo off
> setlocal
> set  _WHERE_IS_M2=%~dp0
> set M2_LOCAL_HOME=%__WHERE_IS_M2:\bin=%
> @REM echo %M2_LOCAL_HOME%
> endlocal & set M2_HOME=%M2_LOCAL_HOME%

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira