You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Benjamin Bentmann (JIRA)" <ji...@codehaus.org> on 2010/03/27 23:25:23 UTC
[jira] Commented: (MNG-3529) mvn -Da=" " throws an excepltion
[ http://jira.codehaus.org/browse/MNG-3529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=215676#action_215676 ]
Benjamin Bentmann commented on MNG-3529:
----------------------------------------
The problem originates from the Unix shell script we use to launch Maven, the relevant part:
{noformat}
QUOTED_ARGS=""
while [ "$1" != "" ] ; do
QUOTED_ARGS="$QUOTED_ARGS \"$1\""
shift
done
[...]
exec [...] $QUOTED_ARGS
{noformat}
While I can't explain it, this screws up the parameter passing and makes {{-D=" "}} parse as the two parameters {{"-D=}} and {{"}}
There seem to be two possible solutions to this:
a) Nuke the QUOTED_ARGS variable and use the special variable {{$@}} instead, i.e.
{noformat}
exec [...] "$@"
{noformat}
b) Mimic Ant's launch script and do
{noformat}
exec_cmd="exec [...] $QUOTED_ARGS"
eval $exec_cmd
{noformat}
Personally, I don't enough about Unix shell scripting to judge which of these is preferrable or might have unwanted side effects so Unix gurus please speak up.
> mvn -Da=" " throws an excepltion
> --------------------------------
>
> Key: MNG-3529
> URL: http://jira.codehaus.org/browse/MNG-3529
> Project: Maven 2 & 3
> Issue Type: Bug
> Components: Command Line
> Affects Versions: 2.0.8
> Reporter: Sean Bridges
> Priority: Trivial
> Fix For: 3.0-alpha-8
>
>
> Doing,
> mvn -Da=" "
> throws,
> ---------------------------------------------------
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:146)
> at java.lang.StringBuffer.setLength(StringBuffer.java:154)
> at org.apache.maven.cli.MavenCli$CLIManager.cleanArgs(MavenCli.java:793)
> at org.apache.maven.cli.MavenCli$CLIManager.parse(MavenCli.java:746)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:100)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
--
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