Le 26 avr. 2014 à 20:25, Gary Gregory <garydgreg...@gmail.com> a écrit :
> Wow, this could do it. Did this make it in 2.4-rc1? Nope, you should take the latest build. You can have some there: https://builds.apache.org/job/Ivy/ And for Eclipse: https://builds.apache.org/job/IvyDE-updatesite/ Nicolas > > Gary > > <div>-------- Original message --------</div><div>From: Nicolas Lalevée > <nicolas.lale...@hibnet.org> </div><div>Date:04/26/2014 12:55 (GMT-05:00) > </div><div>To: ivy-user@ant.apache.org </div><div>Subject: Re: How do I add > all jars in a zip as dependencies? </div><div> > </div>Maybe you can use a trick. In OSGi, a bundle can be considered as a zip > of jars to be added to the classpath. And Ivy-Ant & IvyDE are supporting it > (both trunk version though). > > A such OSGi bundle needs in its MANIFEST.MF to have an entry > 'Bundle-Classpath' listing all the paths to the inner jars. So your zip of > jar should contain a META-INF/MANIFEST.MF with a such entry. > > To tell Ivy that the artifact should be processed after download, you should > use the "packaging" feature [1]. The ivy.xml of your zip of jars should > contains the artifact declaration: > <artifact name="my-zip-of-jars" type="jar" ext="zip" packaging="zip" /> > > Then we must computed the exploded classpath with the OSGI trick. > > For Ant, you should use the cachepath task with the attribute osgi to true > (this is not documented, I forgot it). > <cachepath pathid="classpath" conf="default" osgi="true" /> > > For IvyDE, you should then enable the "Read OSGi metadata" option on the > classpath container [2]. > > This feature is very new (trunk only), so there may be some bugs. You're more > than welcomed to report them. > > Nicolas > > [1] http://ant.apache.org/ivy/history/trunk/concept.html#packaging > [2] http://ant.apache.org/ivy/ivyde/history/trunk/preferences.html#classpath > > Le 25 avr. 2014 à 23:27, Gary Gregory <garydgreg...@gmail.com> a écrit : > >> Thank you all for your replies. >> >> It seems that for all the avenues proposed, I'd have to end up writing an >> ivy.xml file, _which is what I want to avoid_. Even if I did that >> programmatically, what would it contain based on a directory full of jars? >> >> Could I just make up dummy org names and module names, since there's not >> going to be OSGi type of info in most of these jars files. I guess not >> since I'd have to give the file back to Ivy for by calling ivy:resolve. >> >> What I want is <ivy:resolveJars dir="..." pattern="*.jar" conf="..."/> but >> that does not exist :( >> >> At the end of the day I want the jars on a classpath in IvyDE and Ant. >> >> In Ant I can do the above easily "make a cp from all the jars over here", >> but in IvyDE? I guess I'll have to add them all to the .classpath file, not >> great... >> >> Am I missing something? >> >> Gary >> >> >> On Fri, Apr 25, 2014 at 3:34 PM, Zac Jacobson <pie....@gmail.com> wrote: >> >>> I don't know an approach to generate the dependencies lines at build time. >>> I think you'd have to by-script or by-hand create the dependency lines in >>> an ivy file somewhere. >>> >>> For a package resolver, when you're defining the package you would also >>> define an ivy.xml file with dependencies for each conf in that package. >>> Then from your project, you would depend only on your teiid package, and >>> let ivy cascade through the dependencies as usual. This would be an >>> advantage if you are depending on teiid from multiple projects, you would >>> only need to manage those dependencies in one place. >>> >>> Regardless of where you do this, if there's dependencies in teiid that >>> match existing libraries (but named slightly differently) in your primary >>> repository, then you can tweak your ivy file to match the module names that >>> you're familiar with so you don't get duplicate classes in different jars >>> on your classpath. As an aside: I believe this is a large part of the >>> motivation behind the ivy roundup project. >>> >>> Ivy roundup source is available for checkout. I did a quick search around >>> in there: have a look at the org.glassfish.jersey module package for an >>> example of a larger project with lots of configurations and dependencies. >>> >>> https://code.google.com/p/ivyroundup/ >>> >>> Good luck! >>> Zac >>> >>> >>> On Fri, Apr 25, 2014 at 12:00 PM, Gary Gregory <garydgreg...@gmail.com >>>> wrote: >>> >>>> Hm... so the package resolver sounds like a nice way to cache downloaded >>>> zips and unzip the contents into the ivy cache in one step (albeit a >>> heavy >>>> step, which is fine.) >>>> >>>> But... how does this address the meat of my problem: I want all the jars >>> in >>>> the zip to end up as dependencies for my conf such that my project can be >>>> built with Ant and Eclipse IvyDE. >>>> >>>> If I have to list all 102 dependencies one at a time in dependency >>>> elements, then I do not need all of this unzipping and I can do it the >>>> 'classic' way... arg. >>>> >>>> Thoughts? >>>> >>>> Gary >>>> >>>> >>>> On Fri, Apr 25, 2014 at 11:27 AM, <pie....@gmail.com> wrote: >>>> >>>>> Could you use the package resolver to fetch the dependency in a way >>> that >>>>> you don't have to do any explicit manipulations after you have the >>>>> artifacts? >>>>> >>>>> >>>> >>> http://ant.apache.org/ivy/history/latest-milestone/resolver/packager.html >>>>> >>>>> It would take some effort to define the package config. >>>>> >>>>> >>>>> Original Message >>>>> From: Gary Gregory >>>>> Sent: Friday, April 25, 2014 07:49 >>>>> To: ivy-user@ant.apache.org >>>>> Reply To: ivy-user@ant.apache.org >>>>> Subject: How do I add all jars in a zip as dependencies? >>>>> >>>>> Hi All: >>>>> >>>>> I am working on a project to embed Teiid (FOSS project from JBoss) in >>> our >>>>> application. The embedded zip file for this project contains 103 jars >>>>> scattered in many directories. Adding the top level jars from this >>>> project >>>>> through the dependency element with 'transitive' set to truedoes not >>> work >>>>> because some dependencies fail because some modules include variables >>>> like >>>>> "org.apache.accumulo#accumulo-core;${version.accumulo}" >>>>> >>>>> So instead I've created a trigger like this: >>>>> >>>>> <triggers> >>>>> <ant-call target="teiid-unzip" prefix="teiid-unzip" >>>>> event="post-download-artifact" filter="organization=org.jboss.teiid AND >>>>> module=teiid AND revision=${teiid.version} AND type=zip AND >>>>> status=successful"/> >>>>> </triggers> >>>>> >>>>> To unzip the file locally. Next up: how do I add all the jars as >>>>> dependencies? Is there a *.jar kind of call I can make/configure? >>>>> >>>>> Thank you, >>>>> Gary >>>>> >>>>> -- >>>>> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org >>>>> Java Persistence with Hibernate, Second Edition< >>>>> http://www.manning.com/bauer3/> >>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> >>>>> Spring Batch in Action <http://www.manning.com/templier/> >>>>> Blog: http://garygregory.wordpress.com >>>>> Home: http://garygregory.com/ >>>>> Tweet! http://twitter.com/GaryGregory >>>>> >>>> >>>> >>>> >>>> -- >>>> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org >>>> Java Persistence with Hibernate, Second Edition< >>>> http://www.manning.com/bauer3/> >>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> >>>> Spring Batch in Action <http://www.manning.com/templier/> >>>> Blog: http://garygregory.wordpress.com >>>> Home: http://garygregory.com/ >>>> Tweet! http://twitter.com/GaryGregory >>>> >>> >> >> >> >> -- >> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org >> Java Persistence with Hibernate, Second >> Edition<http://www.manning.com/bauer3/> >> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> >> Spring Batch in Action <http://www.manning.com/templier/> >> Blog: http://garygregory.wordpress.com >> Home: http://garygregory.com/ >> Tweet! http://twitter.com/GaryGregory >