Return-Path: X-Original-To: apmail-ant-ivy-user-archive@www.apache.org Delivered-To: apmail-ant-ivy-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F086C10B30 for ; Sun, 27 Apr 2014 20:24:35 +0000 (UTC) Received: (qmail 48776 invoked by uid 500); 27 Apr 2014 20:24:35 -0000 Delivered-To: apmail-ant-ivy-user-archive@ant.apache.org Received: (qmail 48698 invoked by uid 500); 27 Apr 2014 20:24:34 -0000 Mailing-List: contact ivy-user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ivy-user@ant.apache.org Delivered-To: mailing list ivy-user@ant.apache.org Received: (qmail 48690 invoked by uid 99); 27 Apr 2014 20:24:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Apr 2014 20:24:33 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of garydgregory@gmail.com designates 209.85.192.173 as permitted sender) Received: from [209.85.192.173] (HELO mail-pd0-f173.google.com) (209.85.192.173) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Apr 2014 20:24:29 +0000 Received: by mail-pd0-f173.google.com with SMTP id p10so4622011pdj.18 for ; Sun, 27 Apr 2014 13:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Y+jLkokdSfeG9KLWaX11Ls9qwFqGHpNV8koPA4QkjPY=; b=myD5ifmluS/XVpg7Hl+PZA5KprrLwba52x62W2L/PFr3wIQ/JkGW3Hhse+OSvVDULM G7Be/gnpWeRTBVIWHkYz3Url8Ba/1KpxNtKm7hGDgyP+xLhBO6EIkjdPFVBfSyrvrHrb g9LML3OTVmq2hfcnaeEvIM0piqpQE6wUgKv1jVRLtvrGZi2rcGkRYvPH0rxq1WZqUFew mE+QOPbhQPGxh2HP5p8xAwvShz5TubacaKriVvsA7d88XY+MmMscUdAGh+IBvutCFqlw fORN+1+5punEVjx+wmCKb4fy9U4VRg3VHBNhMSNrQ87aIKqRECjwW2eeL1uTKciKxkdR uzLA== MIME-Version: 1.0 X-Received: by 10.68.241.68 with SMTP id wg4mr24810794pbc.66.1398630245762; Sun, 27 Apr 2014 13:24:05 -0700 (PDT) Received: by 10.70.30.33 with HTTP; Sun, 27 Apr 2014 13:24:05 -0700 (PDT) In-Reply-To: <882718A8-BCA0-4A8D-B90A-5C5645B5FB42@hibnet.org> References: <882718A8-BCA0-4A8D-B90A-5C5645B5FB42@hibnet.org> Date: Sun, 27 Apr 2014 16:24:05 -0400 Message-ID: Subject: Re: How do I add all jars in a zip as dependencies? From: Gary Gregory To: "ivy-user@ant.apache.org" Content-Type: multipart/alternative; boundary=047d7b33952df88b3e04f80bfaf5 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b33952df88b3e04f80bfaf5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you all for the constructive feedback. I think that I've found a non-elegant solution to this real world problem that seems to fall out of the scope of the standard Ivy model. Perhaps this user story will be covered in an upcoming Ivy version. - Depend on the zip file in ivy.xml (today JBoss Teiid, tomorow Apache CXF and its deps as well). - Unzip it through an Ivy post retrieve trigger with an ant-build call. - In the Ant build: - Create a classpath from all jars in the unzipped dir, use it for compilation and testing. - Copy the same jars to some stable folder in my Eclipse project - Document that developers must: - run a certain task to set up their IDE. We do this now anyway because we need to generate JAXB code for the rest of our code base - manullay add all the jars in the folder mentioned above to .classpath (a one time deal.) This should make it easier to update to upcoming versions of Teiid and CXF, and to bring along theirs deps. Gary On Sat, Apr 26, 2014 at 7:40 PM, Nicolas Lalev=C3=A9e wrote: > > Le 26 avr. 2014 =C3=A0 22:29, Gary Gregory a =C3= =A9crit : > > > The zip I am dealing with has no manifest of course. So I would need to > make a copy of the zip and add a manifest in the build. I would do that i= n > a trigger I think. Will ivy be able to find a zip I create as a sibling o= f > the original one? > > Probably not. > > Maybe you could implement your own "packaging", which will unzip after > download, like the default one, but could also generate that required > MANIFEST file. > > Packaging like many features in Ivy has been implemented as a plugin. You > can implement one, add it to the classpath [1], declare it [2], and use i= t > in your ivysettings (just add an xml element with the chosen name, it wil= l > automatically registered within Ivy). > > About the implementation, see ZipPacking [3]. > > Nicolas > > [1] > http://ant.apache.org/ivy/history/latest-milestone/settings/classpath.htm= l > [2] > http://ant.apache.org/ivy/history/latest-milestone/settings/typedef.html > [3] > http://svn.apache.org/repos/asf/ant/ivy/core/trunk/src/java/org/apache/iv= y/core/pack/ZipPacking.java > > > > > > Gary > > > >
-------- Original message --------
From: Nicolas Lalev= =C3=A9e < > nicolas.lalevee@hibnet.org>
Date:04/26/2014 12:55 > (GMT-05:00)
To: ivy-user@ant.apache.org
Subject: > Re: How do I add all jars in a zip as dependencies?
> >
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 o= f > 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: > > > > > > 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). > > > > > > For IvyDE, you should then enable the "Read OSGi metadata" option on th= e > classpath container [2]. > > > > This feature is very new (trunk only), so there may be some bugs. You'r= e > 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 =C3=A0 23:27, Gary Gregory a = =C3=A9crit : > > > >> 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 n= ot > >> 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:resolv= e. > >> > >> What I want is > 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 > 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 line= s > in > >>> an ivy file somewhere. > >>> > >>> For a package resolver, when you're defining the package you would al= so > >>> define an ivy.xml file with dependencies for each conf in that packag= e. > >>> 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 tha= t > >>> match existing libraries (but named slightly differently) in your > primary > >>> repository, then you can tweak your ivy file to match the module name= s > 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 >>>> 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 t= he > >>>> 'classic' way... arg. > >>>> > >>>> Thoughts? > >>>> > >>>> Gary > >>>> > >>>> > >>>> On Fri, Apr 25, 2014 at 11:27 AM, 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? > >>>>> > >>>>> =E2=80=8E > >>>> > >>> > 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 ja= rs > >>>>> scattered in many directories. Adding the top level jars from this > >>>> project > >>>>> through the dependency element with 'transitive' set to truedoes no= t > >>> work > >>>>> because some dependencies fail because some modules include variabl= es > >>>> like > >>>>> "org.apache.accumulo#accumulo-core;${version.accumulo}" > >>>>> > >>>>> So instead I've created a trigger like this: > >>>>> > >>>>> > >>>>> >>>>> event=3D"post-download-artifact" filter=3D"organization=3Dorg.jboss= .teiid > AND > >>>>> module=3Dteiid AND revision=3D${teiid.version} AND type=3Dzip AND > >>>>> status=3Dsuccessful"/> > >>>>> > >>>>> > >>>>> 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: garydgregory@gmail.com | ggregory@apache.org > >>>>> Java Persistence with Hibernate, Second Edition< > >>>>> http://www.manning.com/bauer3/> > >>>>> JUnit in Action, Second Edition > >>>>> Spring Batch in Action > >>>>> Blog: http://garygregory.wordpress.com > >>>>> Home: http://garygregory.com/ > >>>>> Tweet! http://twitter.com/GaryGregory > >>>>> > >>>> > >>>> > >>>> > >>>> -- > >>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org > >>>> Java Persistence with Hibernate, Second Edition< > >>>> http://www.manning.com/bauer3/> > >>>> JUnit in Action, Second Edition > >>>> Spring Batch in Action > >>>> Blog: http://garygregory.wordpress.com > >>>> Home: http://garygregory.com/ > >>>> Tweet! http://twitter.com/GaryGregory > >>>> > >>> > >> > >> > >> > >> -- > >> E-Mail: garydgregory@gmail.com | ggregory@apache.org > >> Java Persistence with Hibernate, Second Edition< > http://www.manning.com/bauer3/> > >> JUnit in Action, Second Edition > >> Spring Batch in Action > >> Blog: http://garygregory.wordpress.com > >> Home: http://garygregory.com/ > >> Tweet! http://twitter.com/GaryGregory > > > > --=20 E-Mail: garydgregory@gmail.com | ggregory@apache.org Java Persistence with Hibernate, Second Edition JUnit in Action, Second Edition Spring Batch in Action Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory --047d7b33952df88b3e04f80bfaf5--