jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2 & 3
  • MNG-2989

M2_HOME is incorrect when launched from another process

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Cannot Reproduce
  • Affects Version/s: 2.0.6
  • Fix Version/s: None
  • Component/s: Command Line
  • Labels:
    None
  • Environment:
    WinXP
  • Complexity:
    Intermediate

Description

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%

Issue Links

is related to

Bug - A problem which impairs or prevents the functions of the product. MNG-2178 incorrect M2_HOME guess in mvn.bat

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Brett Porter added a comment - 06/Apr/10 11:17 PM

<target name="help">
<exec executable="cmd">
<arg value="/c"/>
<arg value="mvn.bat"/>
<arg value="-v"/>
</exec>
</target>

Works for me without M2_HOME set.

Show
Brett Porter added a comment - 06/Apr/10 11:17 PM <target name="help"> <exec executable="cmd"> <arg value="/c"/> <arg value="mvn.bat"/> <arg value="-v"/> </exec> </target> Works for me without M2_HOME set.

People

  • Assignee:
    Brett Porter
    Reporter:
    Tim Reilly
Vote (1)
Watch (1)

Dates

  • Created:
    17/May/07 12:16 PM
    Updated:
    06/Apr/10 11:17 PM
    Resolved:
    06/Apr/10 11:17 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.