Using Ivy launcher, passing arguments to launched class.

2015-07-22 Thread Krzysztof Harpula
Hello,

I have the following problem:

I want to launch my main class using Ivy launcher as documented in Ivy
manuals:

java -jar ivy.jar -main com.my.MainClass


My main class  expects parameters from command line in the format:
-paramName:paramValue

I try using Ivy launcher with -args option which is documented as follows:

-args args the arguments to give to the launched process


java -jar ivy.jar -main com.my.MainClass -args -param1:val1


However Ivy is not able to pass such a parameter into my class as it
interprets it as Ivy parameter which is not recognized printing: 
Unrecognized option: -param1:val1. (message from Ivy launcher)

So if I try what follows (remove - from my parameter):

java -jar ivy.jar -main com.my.MainClass -args param1:val1


Ivy passes param1:val1 as argument to my main however my application
does not recognize it as it expects its all parameters to start with -
just as Ivy launcher does.

I think this is either a *BUG* or I am missing something. It seems Ivy
launcher interprets  values after -args beginning with - as another
Ivy parameters. Is any way to pass parameters starting with - to the
launched class? Please help.

Best regards.





Re: Using Ivy launcher, passing arguments to launched class.

2015-07-23 Thread Krzysztof Harpula
Yes I tried in double and single quotes.  The effect is that theses
quotes are passed as part of command line arguments to  launched class
so without modification of launched class to strip off theses quotes it
still does not work. I think it is a common case that applications have
parameters starting with - and not expecting quotes in values of
command line arguments. It looks to be a bug in Ivy. So far I have no
work around to it.

Regards.



On 2015-07-23 14:14, Jaikiran Pai wrote:
 Have you tried to enclose those parameters in double quotes:

 java -jar ivy.jar -main com.my.MainClass -args -param1:val1
 -param2:val2

 -Jaikiran



 On Wednesday 22 July 2015 07:17 PM, Krzysztof Harpula wrote:
 Hello,

 I have the following problem:

 I want to launch my main class using Ivy launcher as documented in Ivy
 manuals:

 java -jar ivy.jar -main com.my.MainClass


 My main class  expects parameters from command line in the format:
 -paramName:paramValue

 I try using Ivy launcher with -args option which is documented as
 follows:

 -args args the arguments to give to the launched process


 java -jar ivy.jar -main com.my.MainClass -args -param1:val1


 However Ivy is not able to pass such a parameter into my class as it
 interprets it as Ivy parameter which is not recognized printing:
 Unrecognized option: -param1:val1. (message from Ivy launcher)

 So if I try what follows (remove - from my parameter):

 java -jar ivy.jar -main com.my.MainClass -args param1:val1


 Ivy passes param1:val1 as argument to my main however my application
 does not recognize it as it expects its all parameters to start with -
 just as Ivy launcher does.

 I think this is either a *BUG* or I am missing something. It seems Ivy
 launcher interprets  values after -args beginning with - as another
 Ivy parameters. Is any way to pass parameters starting with - to the
 launched class? Please help.

 Best regards.







Stand alone usage - early exit of application

2015-07-17 Thread Krzysztof Harpula
Hi, I am starting to use Ivy. I wanted to create a batch file which
launches my application using stand alone ivy launcher. I noticed that
my application starts and then immediately terminates. I checked the
sources of Ivy launcher and I van see the following piece of code:

 public static void main(String[] args) throws Exception {
CommandLineParser parser = getParser();
try {
run(parser, args);
System.exit(0);
} catch (ParseException ex) {
System.err.println(ex.getMessage());
usage(parser, false);
System.exit(1);
}
}

The reason of early exit of application is the call to System.exit(0).
It does not seem to make any sense here. I try to start a server
application where the main thread just starts all up and then it dies.
The rest is controlled by IO threads listening on sockets. The
application ends when last non daemon thread exits. With present
implementation of Ivy launcher, I can not use it because it effectively
kills my application. Could you please fix it?



Re: Stand alone usage - early exit of application

2015-07-20 Thread Krzysztof Harpula
Hello,

The use case is different.

I have an eclipse project. Within eclipse IDE I use IvyDE. However
during development sometimes I want to start my application outside of
IDE (due to Eclipse performance issues). I do it by a batch file
(Windows). From documentation I saw that it is possible to use Ivy not
only as part of the build but also as the application launcher from a
batch file. See the link to Ivy doc bellow.

http://ant.apache.org/ivy/history/2.0.0/standalone.html

So I wrote a batch file which starts my application using Ivy launcher
which offers great possibility to resolve all dependencies at the moment
of start using the same ivy.xml .
*
**java -jar ivy-2.0.4.jar -ivy ivy.xml -confs default -main
com.my.MainClass -cp .\classes*

However I noticed that my application stared using Ivy launcher
terminates prematurely. I looked at the source code of Ivy launcher, and
i noticed that the launcher starts the application using specified class
and its main method, however as soon as the main of the called class
ends Ivy launcher *calls System.exit() which terminates the VM.* My 
application is a mulch-threaded server an *my main method  just sets up
and starts up the application and exits.**The application lives as long
as the last non-daemon thread terminates. **
**
*The assumption made by Ive designers/developers that each application
should terminate as soon as when its main terminates is wrong. In Java
the application terminates when its last non-daemon thread stops. In
present version using Ivy as an application launcher is not possible
because*it just kills the VM much too early*. See the source code from
Ivy launcher (this comes from sources of Ivy: *org.apache.ivy.Main*).
*In bold you can see the problematic line of code which kill s the VM.*
*I believe that it could be removed making Ivy launcher usable.*

  public static void main(String[] args) throws Exception {
 CommandLineParser parser = getParser();
 try {
 run(parser, args);
*System.exit(0); *
 } catch (ParseException ex) {
 System.err.println(ex.getMessage());
 usage(parser, false);
 System.exit(1);
 }
 }


I would appreciate if this could be fixed.

Best regards and greetings.


Support for Java Nodules in Ivy/IvyDE

2018-06-11 Thread Krzysztof Harpula
Hi everyone, Is there any chance or plan or schedule to introduce
support for Java Modules in Ivy & Ivy DE?