You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2004/07/06 15:45:47 UTC

[jira] Created: (MAVEN-1359) maven.bat fails when %HOME% contains a back slash at the end

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MAVEN-1359

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MAVEN-1359
    Summary: maven.bat fails when %HOME% contains a back slash at the end
       Type: Bug

     Status: Unassigned
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: maven
 Components: 
             cli
   Versions:
             1.0-rc4

   Assignee: 
   Reporter: Kenichi Masuko

    Created: Tue, 6 Jul 2004 9:45 AM
    Updated: Tue, 6 Jul 2004 9:45 AM
Environment: Windows XP, Windows 2000

Description:
In maven.bat, java is launched with the following command:

%MAVEN_JAVA_EXE%  ... "-Duser.home.env=%HOME%" ...

When the last character of the content of HOME is a back slash,
maven failed to start.

For example, when HOME is set to be d:\
"-Duser.home.env=%HOME%" becomes "-Duser.home.env=d:\"
and Windows sees the character sequence \" at the end
as a single character (an escape character + a special character)
rather than a character followed by a quotation which ends a parameter.
This breaks matching of quotation character pairs
making the last pair consume all the characters after it.
As a result, main java class name near the end of the line
is concatenated to the content of the last pair,
and java doesn't see the main class to run and exits.

I first tried to change HOME to be d: rather than d:\
but Windows 2000/XP doesn't accept d:
saying it is not a valid absolute path.

So, if the last character of HOME is a back slash,
I think we need to replace it with double back slashes like below.

set HOME_ENV_PARAM_LEFT=%HOME:~0,-1%
set HOME_ENV_PARAM_RIGHT=%HOME:~-1%
set HOME_ENV_PARAM=%HOME_ENV_PARAM_LEFT%%HOME_ENV_PARAM_RIGHT:\=\\%

%MAVEN_JAVA_EXE%  ... "-Duser.home.env=%HOME_ENV_PARAM%" ...



---------------------------------------------------------------------
JIRA INFORMATION:
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

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Closed: (MAVEN-1359) maven.bat fails when %HOME% contains a back slash at the end

Posted by ji...@codehaus.org.
Message:

   The following issue has been closed.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MAVEN-1359

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MAVEN-1359
    Summary: maven.bat fails when %HOME% contains a back slash at the end
       Type: Bug

     Status: Closed
   Priority: Major
 Resolution: DUPLICATE

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: maven
 Components: 
             cli
   Versions:
             1.0-rc4

   Assignee: 
   Reporter: Kenichi Masuko

    Created: Tue, 6 Jul 2004 9:45 AM
    Updated: Tue, 6 Jul 2004 11:37 AM
Environment: Windows XP, Windows 2000

Description:
In maven.bat, java is launched with the following command:

%MAVEN_JAVA_EXE%  ... "-Duser.home.env=%HOME%" ...

When the last character of the content of HOME is a back slash,
maven failed to start.

For example, when HOME is set to be d:\
"-Duser.home.env=%HOME%" becomes "-Duser.home.env=d:\"
and Windows sees the character sequence \" at the end
as a single character (an escape character + a special character)
rather than a character followed by a quotation which ends a parameter.
This breaks matching of quotation character pairs
making the last pair consume all the characters after it.
As a result, main java class name near the end of the line
is concatenated to the content of the last pair,
and java doesn't see the main class to run and exits.

I first tried to change HOME to be d: rather than d:\
but Windows 2000/XP doesn't accept d:
saying it is not a valid absolute path.

So, if the last character of HOME is a back slash,
I think we need to replace it with double back slashes like below.

set HOME_ENV_PARAM_LEFT=%HOME:~0,-1%
set HOME_ENV_PARAM_RIGHT=%HOME:~-1%
set HOME_ENV_PARAM=%HOME_ENV_PARAM_LEFT%%HOME_ENV_PARAM_RIGHT:\=\\%

%MAVEN_JAVA_EXE%  ... "-Duser.home.env=%HOME_ENV_PARAM%" ...



---------------------------------------------------------------------
JIRA INFORMATION:
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

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org