I am using the maven plugin appassembler to generate a unix script. In its tag, I put sth like:
<commandLineArguments>
<commandLineArgument>$1</commandLineArgument>
<commandLineArgument>$2</commandLineArgument>
<commandLineArgument>$3</commandLineArgument>
</commandLineArguments>
The resultant script, however, shows $1 $2 $3 "$@"
I don't know where the last one came from, it therefore repeat the first 3 arguments.
Mojo's AppAssembler Maven Plugin generates a script that always appends all the command line arguments provided to the script onto the JVM's launch command. Thus if you did nothing, the
"$@"
will be the last thing on the JVM command used to start the program.The
<commandLineArguments>
tag is used to inject additional command line arguments before the ARGLIST matcher.It seems (to me) that you think you needed to add the positional markers in order to get the parameters passed through, hence the snippet you were adding. That is both:
With regard to the second point consider the case where the second parameter is the name of a file that contains a space charater. If I launch the script for you program like so
you will actually see the following being passed through to your Java program with the configuration you provided:
Document.txt
(all of $1)Document
($2 is expanded, but not quoted so now gets re-evaluated)2.txt
Copy
($3 is expanded, but not quoted, so also gets re-evaluated, spaces seen as argument separator again)of
Document
3.txt
Document.txt
(now the ARGLIST matcher provides everything correctly)Document 2.txt
Copy of Document 3.txt
Doc4.txt
The solution is simple. Stop trying to configure something you don't need to configure!