You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Jaikiran <ja...@yahoo.co.in> on 2009/10/20 13:51:02 UTC

Programmatic use of Ivy

Hello everyone,

Is there a place where i can find examples or javadocs anything similar for
using Ivy programatically through Java? Some of the mails i see in this list
show that this is possible. But i couldn't find a location where these APIs
are listed. Could someone point me to it?

-Jaikiran
-- 
View this message in context: http://www.nabble.com/Programmatic-use-of-Ivy-tp25973730p25973730.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Programmatic use of Ivy

Posted by Jaikiran <ja...@yahoo.co.in>.
Tjeerd,

I tried downloading the attachment, but it gives me a corrupt .tar.gz.
Probably some issue with the mailing list server?   
As for extending IzPack installer, i haven't gone in that direction yet,
since this custom installer itself is nothing more than a few classes and
actually has to parse some specific format files for which i would anyway
need my custom code.



-- 
View this message in context: http://www.nabble.com/Programmatic-use-of-Ivy-tp25973730p26030624.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Programmatic use of Ivy

Posted by Tjeerd Verhagen <tj...@gmail.com>.
ok, nice to know, it helped you. In that case also look at the cp option, as
through that it would be possible to use / load an application, which uses
internally Ivy, for resolving dependencies. I created then an example, where
it was possible to start a application through it's jar file, in which
packages where defined. It then downloaded those jar through Ivy :)

Ok, I could not let it rest, so created an example of my previous
suggestion.

Indeed you can also let the installer resolve and install the required
packages, but as said, I even let the started application do that.

Which installer package are you extending (IzPack maybe?).

Regards, Tjeerd

Re: Programmatic use of Ivy

Posted by Jaikiran <ja...@yahoo.co.in>.

Tjeerd Verhagen wrote:
> 
> What are you trying to achieve? What was the original idea, which (maybe /
> probably) could be solved by using Ivy in stand alone mode?
> 
Ah! I now realize that i did not give some context on what i was trying to
achieve. I have a custom "installer" which can install "components" (let's
just call them that). Each component can "depend" on other components. So
while installing, i should make sure that all the dependencies are
satisfied. Instead of re-inventing the wheel of dependency management (and
conflict management), i plan to use Ivy's dependency manager to take care of
these dependencies during installation.

So my installer, which is an Java program *internally* needs to use Ivy to
take care of these dependencies. Sort of Embedded Ivy (if that's the right
word). To give a more clear idea, consider the case of Ant which provides
Java APIs (for example: org.apache.tools.ant.Project) which you can use
within your own programs to do achieve the same functionality that you would
have achieved through running ant standalone command.


Tjeerd Verhagen wrote:
> 
> Maybe you should create your own version of the Main (by copying it) and
> modify it in the way you want to use it (remove the System.exit(calls)
> etc.
> It probably does not have use any package private classes. So it should be
> possible (even creating your own package name then).
> 
Although i probably won't use the Main, but i definitely am going to do
something similar to what Main currently does. i.e. I am going to see which
(undocumented) APIs it uses to achieve its features. So yes, the JIRA that
you pointed to, did provide some useful inputs :)


-- 
View this message in context: http://www.nabble.com/Programmatic-use-of-Ivy-tp25973730p26024345.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Programmatic use of Ivy

Posted by Tjeerd Verhagen <tj...@gmail.com>.
You're welcome,

What are you trying to achieve? What was the original idea, which (maybe /
probably) could be solved by using Ivy in stand alone mode?

Maybe you should create your own version of the Main (by copying it) and
modify it in the way you want to use it (remove the System.exit(calls) etc.
It probably does not have use any package private classes. So it should be
possible (even creating your own package name then).

Maybe this idea helps you finding an alternative way, for solving your
original problem.

Success!

On Fri, Oct 23, 2009 at 11:50 AM, Jaikiran <ja...@yahoo.co.in>wrote:

>
> Tjeerd,
>
> Thanks for the efforts :) I looked at the JIRA that you pointed me to.
> Looking at the commit history, they seem to have applied your patch for the
> classpath option, to their "Main" class which according to the javadocs is
> the entry point for Ivy standalone.
> But unfortunately, they have System.exit calls in that Main class which
> makes it impractical to use it within another application :)
>
> I'll continue looking at some of their code and see if i can get some more
> APIs working without bringing Ant and other things into picture. I'll post
> the updates here and the wiki.
>
> Thanks again!
> --
> View this message in context:
> http://www.nabble.com/Programmatic-use-of-Ivy-tp25973730p26023610.html
> Sent from the ivy-user mailing list archive at Nabble.com.
>
>

Re: Programmatic use of Ivy

Posted by Jaikiran <ja...@yahoo.co.in>.
Tjeerd,

Thanks for the efforts :) I looked at the JIRA that you pointed me to.
Looking at the commit history, they seem to have applied your patch for the
classpath option, to their "Main" class which according to the javadocs is
the entry point for Ivy standalone. 
But unfortunately, they have System.exit calls in that Main class which
makes it impractical to use it within another application :)

I'll continue looking at some of their code and see if i can get some more
APIs working without bringing Ant and other things into picture. I'll post
the updates here and the wiki.

Thanks again! 
-- 
View this message in context: http://www.nabble.com/Programmatic-use-of-Ivy-tp25973730p26023610.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Programmatic use of Ivy

Posted by Tjeerd Verhagen <tj...@gmail.com>.
Hi Jaikiran,

just checked my machine at work, which contained some ivy patches also. But
did not find back the 'example' yet.

Not sure if I'll will find it back, at all.

Indeed the javadoc is very poor, I remember debugging and searching and
scanning through the Ivy code for quite some time. To find out things. It
really is a pity this has not improved since then. It is one of the things
that makes it very hard to apply / modify change for your own situation.

Maybe I should post it as example, when I find it back....

Regards, Tjeerd

Re: Programmatic use of Ivy

Posted by Tjeerd Verhagen <tj...@gmail.com>.
Hello Jalklran,

Sorry did not find the code yet, but did find the Jira issue Ivy-543 under
which I committed the patch. Maybe this helps already a little.

I'll check furthere, as know I know also the date around which I created
that stuff.

Regards, Tjeerd


On Thu, Oct 22, 2009 at 8:48 PM, Jaikiran <ja...@yahoo.co.in>wrote:

>
> Tjeerd,
> I personally would be very much interested in any kinds of inputs, like the
> source example you mention - even if it was for an earlier version. Atleast
> that will give me a hint on the possible ways to approach this. And if
> there
> are any changes required, we could then even add it to the wiki (which
> currently lacks this kind of info)
>
>
> Tjeerd Verhagen wrote:
> >
> > Hi,
> >
> > Not sure if my solution still works, but years ago, I already saw this
> > opportunity to use Ivy for loading the run-time jars, required by some
> > application. I actually managed to start up the application, whit minimal
> > number of jars. After that no extra jars, where needed to be delivered
> > with
> > the application. As long as they could be found through the referenced
> Ivy
> > repository.
> > I think I even sent in a 'patch' for this feature (Ivy needed a little
> > change) to make it possible (at that time). But at that time it was not
> > added to the release, as it was just before the finalization of v2.0.0
> > (incubation time at Apache).
> >
> > Only a little configuration was needed at that time, can't remember how
> it
> > was done exactly. Let me know if someone is interested in this code (of
> > that
> > time). Not sure how strong Ivy's interfaces and classes have changed in
> > the
> > mean time.
> >
> > Regards, Tjeerd
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Programmatic-use-of-Ivy-tp25973730p26015245.html
> Sent from the ivy-user mailing list archive at Nabble.com.
>
>

Re: Programmatic use of Ivy

Posted by Jaikiran <ja...@yahoo.co.in>.
Tjeerd,
I personally would be very much interested in any kinds of inputs, like the
source example you mention - even if it was for an earlier version. Atleast
that will give me a hint on the possible ways to approach this. And if there
are any changes required, we could then even add it to the wiki (which
currently lacks this kind of info)
  

Tjeerd Verhagen wrote:
> 
> Hi,
> 
> Not sure if my solution still works, but years ago, I already saw this
> opportunity to use Ivy for loading the run-time jars, required by some
> application. I actually managed to start up the application, whit minimal
> number of jars. After that no extra jars, where needed to be delivered
> with
> the application. As long as they could be found through the referenced Ivy
> repository.
> I think I even sent in a 'patch' for this feature (Ivy needed a little
> change) to make it possible (at that time). But at that time it was not
> added to the release, as it was just before the finalization of v2.0.0
> (incubation time at Apache).
> 
> Only a little configuration was needed at that time, can't remember how it
> was done exactly. Let me know if someone is interested in this code (of
> that
> time). Not sure how strong Ivy's interfaces and classes have changed in
> the
> mean time.
> 
> Regards, Tjeerd
> 
> 

-- 
View this message in context: http://www.nabble.com/Programmatic-use-of-Ivy-tp25973730p26015245.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Programmatic use of Ivy

Posted by Tjeerd Verhagen <tj...@gmail.com>.
Hi,

Not sure if my solution still works, but years ago, I already saw this
opportunity to use Ivy for loading the run-time jars, required by some
application. I actually managed to start up the application, whit minimal
number of jars. After that no extra jars, where needed to be delivered with
the application. As long as they could be found through the referenced Ivy
repository.
I think I even sent in a 'patch' for this feature (Ivy needed a little
change) to make it possible (at that time). But at that time it was not
added to the release, as it was just before the finalization of v2.0.0
(incubation time at Apache).

Only a little configuration was needed at that time, can't remember how it
was done exactly. Let me know if someone is interested in this code (of that
time). Not sure how strong Ivy's interfaces and classes have changed in the
mean time.

Regards, Tjeerd

AW: Programmatic use of Ivy

Posted by Klaas Prause <kp...@blau.de>.
Hi,

I think this is a big issue that need to be resolved some day. The good features of ivy are hardwired to the use of ANT. A lot of documented features are implemented directly within the ANT-extension of Ivy, this prevents them from being used standalone. I tried to write an Ivy extension for Apache buildr using the Java-API. In the end I had to go through ANT (using Antwrap) because all the cool stuff you want to use with Ivy is in the ANT targets.
A lot of refactoring needs to be done, so that the features can be used as API and Ant is only one interface to use Ivy. I hope Ivy changes in this direction, so that it is easy to choose a different build application than Ant with troubles.

Regards

-----Ursprüngliche Nachricht-----
Von: Jaikiran [mailto:jai_forums2005@yahoo.co.in] 
Gesendet: Dienstag, 20. Oktober 2009 13:51
An: ivy-user@ant.apache.org
Betreff: Programmatic use of Ivy


Hello everyone,

Is there a place where i can find examples or javadocs anything similar for
using Ivy programatically through Java? Some of the mails i see in this list
show that this is possible. But i couldn't find a location where these APIs
are listed. Could someone point me to it?

-Jaikiran
-- 
View this message in context: http://www.nabble.com/Programmatic-use-of-Ivy-tp25973730p25973730.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: AW: Programmatic use of Ivy

Posted by Jaikiran <ja...@yahoo.co.in>.
Klaas,

You are right about the tight coupling with Ant properties. I spent some
time looking into the Ivy code and it definitely makes it difficult to use
it outside of the Ant tasks. Although, i could get the minimal
resolve/retrieve features working with some of the Ivy APIs (keeping Ant out
of the equation), there are some other APIs like the reporting ones which i
found almost impossible to use without those Ant properties.

As of now, i have documented the minimal set of APIs i got to work in the
wiki http://cwiki.apache.org/confluence/display/IVY/Programmatic+use+of+Ivy.
If anyone wants to add/edit there, feel free to do so. I might have to look
into some more APIs like the conflict resolution ones in the near future. I
hope those are usable!
-- 
View this message in context: http://www.nabble.com/Programmatic-use-of-Ivy-tp25973730p26010005.html
Sent from the ivy-user mailing list archive at Nabble.com.


AW: Programmatic use of Ivy

Posted by Klaas Prause <kp...@blau.de>.
Hi,

I think this is a big issue that need to be resolved some day. The good features of ivy are hardwired to the use of ANT. A lot of documented features are implemented directly within the ANT-extension of Ivy. This prevents them from being used standalone. As an example using Ant variables to store state.

I tried to write an Ivy extension for Apache buildr using the Java-API. In the end I had to go through ANT (using Antwrap) because all the cool stuff you want to use with Ivy is in the ANT targets.
A lot of Refactoring needs to be done, so that the features can be used as API and Ant is only one interface to use Ivy. I hope Ivy changes in this direction, so that it is easy to choose a different build application with troubles.

Regards
Klaas

-----Ursprüngliche Nachricht-----
Von: Jaikiran [mailto:jai_forums2005@yahoo.co.in] 
Gesendet: Dienstag, 20. Oktober 2009 13:51
An: ivy-user@ant.apache.org
Betreff: Programmatic use of Ivy


Hello everyone,

Is there a place where i can find examples or javadocs anything similar for
using Ivy programatically through Java? Some of the mails i see in this list
show that this is possible. But i couldn't find a location where these APIs
are listed. Could someone point me to it?

-Jaikiran
-- 
View this message in context: http://www.nabble.com/Programmatic-use-of-Ivy-tp25973730p25973730.html
Sent from the ivy-user mailing list archive at Nabble.com.