Allow "main" parameters to be passed directly (instead of using -args flag)
---------------------------------------------------------------------------
Key: IVY-480
URL: https://issues.apache.org/jira/browse/IVY-480
Project: Ivy
Issue Type: Improvement
Components: Core
Affects Versions: 1.4.1
Reporter: Archie Cobbs
When running ivy in standalone mode using the {{-main}} flag, any extra
parameters passed on the command line (i.e., not as flag arguments) are simply
ignored.
E.g., if I invoke {{java fr.jayasoft.ivy.Main -main com.exmaple.Main foo bar}}
the {{foo bar}} parameters are ignored. To pass "foo" and "bar" to my main
method, I have to use {{-args foo}} and {{-args bar}}.
Suggestion: when using the {{-main}} flag, allow the parameters to the main
method to be passed directly on the command line as "extra" parameters, as an
alternative to using the {{-args}} flag.
The motivation for this is that this would be much easier to deal with in shell
scripts. E.g. suppose I want to write a shell script {{/usr/bin/foo}} which
uses ivy to resolve dependencies and execute some main class
{{com.example.foo.Main}}. To do this I'd have to parse the command line into
individual arguments, then precatenate each one with a {{-args}} flag, etc.
This sounds hard enough, but when you consider that some parameters may be
quoted, it becomes nearly impossible. With the change suggested here, it would
become trivial: I'd just do something like {{ivy -ivy /usr/share/foo.ivy -main
com.example.foo.Main ${1+"$@"} }} in the shell script.
If this is implemented, it should probably become the recommended approach, and
{{-args}} be deprecated.
As a side note, the {{-args}} flag is mis-named: it should be called {{-arg}}
instead (but I'd prefer to have it just be deprecated).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.