You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jochen Stiepel (JIRA)" <ji...@codehaus.org> on 2011/02/24 23:29:22 UTC

[jira] Created: (MNG-5025) CLONE - JAVA_HOME auto discovery - also for windows with mvn.bat

CLONE - JAVA_HOME auto discovery - also for windows with mvn.bat
----------------------------------------------------------------

                 Key: MNG-5025
                 URL: http://jira.codehaus.org/browse/MNG-5025
             Project: Maven 2 & 3
          Issue Type: Improvement
    Affects Versions: 3.0.2
         Environment: Linux, Ubuntu
            Reporter: Jochen Stiepel
            Assignee: Benjamin Bentmann
            Priority: Minor
             Fix For: 3.0.3


When JAVA_HOME is not set (but java command is in the PATH) then bin/mvn script  prints warning message "Warning: JAVA_HOME environment variable is not set." 
I don't want to explicitly set JAVA_HOME variable because I manage my JDK instances by update-java-alternatives in Ubuntu. It switches system wide JDK, but does not set the JAVA_HOME variable. If I would set JAVA_HOME manually then any changes made by update-java-alternatives would not be reflected in JAVA_HOME which is obviously incorrect.

However mvn script can be improved, so that it can guess JAVA_HOME. Actually Groovy startup script does it very well, so I moved auto-discovery code from groovy script to mvn and attach patch here

-- 
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

        

[jira] Updated: (MNG-5025) CLONE - JAVA_HOME auto discovery - also for windows with mvn.bat

Posted by "Jochen Stiepel (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-5025?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jochen Stiepel updated MNG-5025:
--------------------------------

    Attachment: mvn.bat

the changed mvn.bat 

> CLONE - JAVA_HOME auto discovery - also for windows with mvn.bat
> ----------------------------------------------------------------
>
>                 Key: MNG-5025
>                 URL: http://jira.codehaus.org/browse/MNG-5025
>             Project: Maven 2 & 3
>          Issue Type: Improvement
>    Affects Versions: 3.0.2
>         Environment: Linux, Ubuntu
>            Reporter: Jochen Stiepel
>            Priority: Minor
>         Attachments: mvn.bat
>
>
> When JAVA_HOME is not set (but java command is in the PATH) then bin/mvn script  prints warning message "Warning: JAVA_HOME environment variable is not set." 
> I don't want to explicitly set JAVA_HOME variable because I manage my JDK instances by update-java-alternatives in Ubuntu. It switches system wide JDK, but does not set the JAVA_HOME variable. If I would set JAVA_HOME manually then any changes made by update-java-alternatives would not be reflected in JAVA_HOME which is obviously incorrect.
> However mvn script can be improved, so that it can guess JAVA_HOME. Actually Groovy startup script does it very well, so I moved auto-discovery code from groovy script to mvn and attach patch here

-- 
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

        

[jira] Commented: (MNG-5025) CLONE - JAVA_HOME auto discovery - also for windows with mvn.bat

Posted by "Jochen Stiepel (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-5025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=257695#action_257695 ] 

Jochen Stiepel commented on MNG-5025:
-------------------------------------

for windows there is also a part in the startGroovy.bat
http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/bin/startGroovy.bat

this could be added to the mvn.bat:

{noformat}
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
for %%P in (%PATH%) do if exist %%P\..\bin\java.exe set JAVA_HOME=%%P\..
if not "%JAVA_HOME%" == "" goto OkJHome

echo ERROR: JAVA_HOME not found in your environment.
echo Attempting to find JAVA_HOME from PATH also failed.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation
echo.
goto error
{noformat}



> CLONE - JAVA_HOME auto discovery - also for windows with mvn.bat
> ----------------------------------------------------------------
>
>                 Key: MNG-5025
>                 URL: http://jira.codehaus.org/browse/MNG-5025
>             Project: Maven 2 & 3
>          Issue Type: Improvement
>    Affects Versions: 3.0.2
>         Environment: Linux, Ubuntu
>            Reporter: Jochen Stiepel
>            Priority: Minor
>         Attachments: mvn.bat
>
>
> When JAVA_HOME is not set (but java command is in the PATH) then bin/mvn script  prints warning message "Warning: JAVA_HOME environment variable is not set." 
> I don't want to explicitly set JAVA_HOME variable because I manage my JDK instances by update-java-alternatives in Ubuntu. It switches system wide JDK, but does not set the JAVA_HOME variable. If I would set JAVA_HOME manually then any changes made by update-java-alternatives would not be reflected in JAVA_HOME which is obviously incorrect.
> However mvn script can be improved, so that it can guess JAVA_HOME. Actually Groovy startup script does it very well, so I moved auto-discovery code from groovy script to mvn and attach patch here

-- 
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

        

[jira] Updated: (MNG-5025) CLONE - JAVA_HOME auto discovery - also for windows with mvn.bat

Posted by "Benjamin Bentmann (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-5025?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Bentmann updated MNG-5025:
-----------------------------------

    Fix Version/s:     (was: 3.0.3)
         Assignee:     (was: Benjamin Bentmann)

> CLONE - JAVA_HOME auto discovery - also for windows with mvn.bat
> ----------------------------------------------------------------
>
>                 Key: MNG-5025
>                 URL: http://jira.codehaus.org/browse/MNG-5025
>             Project: Maven 2 & 3
>          Issue Type: Improvement
>    Affects Versions: 3.0.2
>         Environment: Linux, Ubuntu
>            Reporter: Jochen Stiepel
>            Priority: Minor
>
> When JAVA_HOME is not set (but java command is in the PATH) then bin/mvn script  prints warning message "Warning: JAVA_HOME environment variable is not set." 
> I don't want to explicitly set JAVA_HOME variable because I manage my JDK instances by update-java-alternatives in Ubuntu. It switches system wide JDK, but does not set the JAVA_HOME variable. If I would set JAVA_HOME manually then any changes made by update-java-alternatives would not be reflected in JAVA_HOME which is obviously incorrect.
> However mvn script can be improved, so that it can guess JAVA_HOME. Actually Groovy startup script does it very well, so I moved auto-discovery code from groovy script to mvn and attach patch here

-- 
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