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 2003/09/24 08:58:10 UTC

[jira] Commented: (MAVEN-786) maven Linux shell script incorrectly quotes arguments it passes through to Java

The following comment has been added to this issue:

     Author: Martin Skopp
    Created: Wed, 24 Sep 2003 1:57 AM
       Body:
What about OS other than linux?
What about other shell than bash?

The script in question has 

    #! /bin/sh

in it's first line, not "#!/bin/bash" which could make a difference on  a UNIX which has the original "sh".

I don't know, does the original "sh" also support/require quotes around $@ ?  Or should the first line of the script better be changed into "#!/bin/bash" ?

just my .02
Martin
---------------------------------------------------------------------
View the issue:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-786


Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MAVEN-786
    Summary: maven Linux shell script incorrectly quotes arguments it passes through to Java
       Type: Bug

     Status: Closed
   Priority: Minor
 Resolution: FIXED

 Time Spent: Unknown
  Remaining: Unknown

    Project: maven
   Fix Fors:
             1.0-rc1
   Versions:
             1.0-beta-10

   Assignee: 
   Reporter: John Farrell

    Created: Fri, 5 Sep 2003 12:35 AM
    Updated: Wed, 24 Sep 2003 12:31 AM
Environment: Linux (in my case, Mandrake 9.1)

Description:
If I want to pass a Java property with a space in it through to my goal,
for example,

maven -e "-Dminestar.release=stable potatoes" zip

maven incorrectly quotes the parameters when passing them to Java resulting in:

BUILD FAILED
Goal "potatoes" does not exist in this project.

HERE'S THE FIX:

Edit the maven shell script. Down the bottom are two lines which say:

    $MAIN_CLASS $@

Change them to

    $MAIN_CLASS "$@"

This tells the shell to quote parameters individually. The bash manual says:

       @      Expands  to  the positional parameters, starting from one.  When
              the  expansion  occurs  within  double  quotes,  each  parameter
              expands to a separate word.  That is, "$@" is equivalent to "$1"
              "$2" ...  When there are no positional parameters, "$@"  and  $@
              expand to nothing (i.e., they are removed).

It took me ages to find this trick for our own system, I know it's confusing as hell.


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