From ivy-user-return-6732-apmail-ant-ivy-user-archive=ant.apache.org@ant.apache.org Thu Apr 29 20:59:54 2010 Return-Path: Delivered-To: apmail-ant-ivy-user-archive@www.apache.org Received: (qmail 38694 invoked from network); 29 Apr 2010 20:59:54 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Apr 2010 20:59:54 -0000 Received: (qmail 44070 invoked by uid 500); 29 Apr 2010 20:59:53 -0000 Delivered-To: apmail-ant-ivy-user-archive@ant.apache.org Received: (qmail 43986 invoked by uid 500); 29 Apr 2010 20:59:53 -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 43978 invoked by uid 99); 29 Apr 2010 20:59:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Apr 2010 20:59:53 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of archie.cobbs@gmail.com designates 74.125.82.45 as permitted sender) Received: from [74.125.82.45] (HELO mail-ww0-f45.google.com) (74.125.82.45) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Apr 2010 20:59:46 +0000 Received: by wwb17 with SMTP id 17so221543wwb.4 for ; Thu, 29 Apr 2010 13:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=dJNoTB33TLvIltU8x+2DYxmXiprga0vztkHmu/TQ4bc=; b=T8qcFzd4BBBbYFirvzUfZujusF+5vgblTOo6zp39+JnjN0q+wgtV5/wo914P7HnW5+ ow2dTV3q+4lSkv7oEXmd6ZI0O1fD4ngbNxYLG79n0DRawtUHlSi7XSdG5we/NNaClcis CwYXU9J4kXCM0BQzVvdVlVlqyUvqbaPiJKFGQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=ORF9aH8XGJLLdpPWlxAXc8zdmPjjruX3BxX9E5dTruRgj5GUxvkHn/speitq41+w3q ml7hKVe8Q9qLmcG++e6PtNjWUKWuZEwNsVsq4t6MaQ2Jkqg1Vmu6k0iAsTCSAhdL4xzk EZd86GeP89037SkVlUeuy1FMdBao+ZPWXOsDM= Received: by 10.216.176.206 with SMTP id b56mr6793856wem.63.1272574765235; Thu, 29 Apr 2010 13:59:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.59.68 with HTTP; Thu, 29 Apr 2010 13:59:05 -0700 (PDT) In-Reply-To: <28405448.post@talk.nabble.com> References: <22461453.post@talk.nabble.com> <22463169.post@talk.nabble.com> <22464286.post@talk.nabble.com> <22465286.post@talk.nabble.com> <28405448.post@talk.nabble.com> From: Archie Cobbs Date: Thu, 29 Apr 2010 15:59:05 -0500 Message-ID: Subject: Re: example ivy & build.xml file for spring/jsf/hibernate project To: ivy-user@ant.apache.org Content-Type: multipart/alternative; boundary=001485f1e36ed50e000485666622 X-Virus-Checked: Checked by ClamAV on apache.org --001485f1e36ed50e000485666622 Content-Type: text/plain; charset=ISO-8859-1 For what it's worth, here is a setup I've used a few times. It requires a little bit of infrastructure (see macros.xml for where to put ivy.jar and ant-contrib.jar) but once you've got that configuring what you want is pretty straightforward. You can view this examplein a Java object database project... you only need to pay attention to these files: build.xml src/build/macros.xml src/ivy/settings.xml src/ivy/ivy.xml -Archie On Thu, Apr 29, 2010 at 3:31 PM, infinity2heaven wrote: > > I tried to use ivy multiple times in the past and refused to use it only > because it was complex enough for my simple needs. I don't want to use > Maven2 for the same reason. Before I grapple, let me give you my use case. > Currently I use an ant build with simple tasks for compile, test, deploy, > clean etc. I have a lib directory structure like this: > > - lib > -- compile > -- test > -- runtime > -- ext > > As you figured, I drop jars (manually) into these folders and my ant build > has a classpath.ref set accordingly for the corresponding tasks. That all > seems so easy because I have an existing app that works, so I copy/paste > jars into the new one. It all works fine. You don't have to read a 200 page > manual on how to use maven or ivy, for instance. > > But I'm a developer too and I know that this copy/paste process sucks and > each time I try to upgrade my libraries, it's a nightmare. There are some > jars in my libs that I don't know why it's there, but I don't want to > remove > them. > > Ok. > > I've used maven for a few opensource projects, it's fine. Seems easy for > starter projects but almost always doesn't work for existing large > projects. > I read about ivy, fiddled around a few times but I was still not convinced. > People talk about Gradle, but I don't understand why would anyone learn a > DSL for writing build scripts. > > Ok. Enough rant. > > So I returned back, decided to spent a full 3 days to figure this out and > here's what I got so far with Ivy: > > - I understand how to writing a basic ivysettings file, resolve/retrieve > jars using ivy-ant tasks and write a simple ivy.xml fle with some > dependencies. But here's the problem: The default dependencies either load > every other dependency or does not load at all. Put simply, I want an ant > task that I can write where I mention, "spring framework" and I want Ivy to > automatically download corresponding dependencies and copy them into the > above folder structure based on the dependency type (compile, runtime ...). > > Is that too much to ask for? Really? Remember, I was doing this all by > hand, > before. > > I still haven't figured a clean way to do it yet. Ivy either downloads all > into one spot, there is no clear way of distinguishing the dependency types > with "conf" setting. My problem is, why should I know what spring needs at > compile time or runtime? Why? Isn't that why I'm using Ivy or Gradle or > whatever fancy tool that comes next? > > As I concluded today (and I could be totally wrong), there is no clean way > of doing this. One has to open up the pom or ivy files of individual > libraries and figure out for themselves what to include or not. > > Wouldn't it be fantastic to write a build file that says -- include > spring-, hibernate-, jsf-, richfaces- > and be done with it? > > > So here are a few configs I tried: > > 1) > > rev="${spring.version}" /> > name="org.springframework.context" rev="${spring.version}"/> > name="org.springframework.context.support" rev="${spring.version}"/> > rev="${spring.version}" /> > name="com.springsource.org.aspectj.weaver" rev="1.5.4"/> > rev="${spring.version}"/> > > rev="${hibernate.version}" "/> > > > 2) > > extends="runtime,master"/> > > > > > > > > > name="org.springframework.core" > rev="${spring.version}" > conf="compile->compile(*),master(*);runtime->runtime(*)"/> > name="org.springframework.context" rev="${spring.version}" > conf="compile->compile(*),master(*);runtime->runtime(*)"/> > name="org.springframework.context.support" rev="${spring.version}" > conf="compile->compile(*),master(*);runtime->runtime(*)"/> > rev="${spring.version}" > conf="compile->compile(*),master(*);runtime->runtime(*)"/> > name="com.springsource.org.aspectj.weaver" rev="1.5.4"/> > rev="${spring.version}" > conf="compile->compile(*),master(*);runtime->runtime(*)"/> > > transitive="true" > conf="compile->compile(*),master(*);runtime->runtime(*)"/> > rev="${hibernate.version}" > conf="compile->compile(*),master(*);runtime->runtime(*)"/> > transitive="false" > conf="compile->compile(*),master(*);runtime->runtime(*)"/> > > force="true" rev="${richfaces.version}"/> > force="true" rev="${richfaces.version}"/> > rev="${richfaces.version}"/> > > > > What is my expectation from a "build tool?" I need to integrate Spring and > Hibernate in my web project. But I don't want to spend two days to figure > what are the runtime and compile time dependencies by myself. I can get > that > by reading a pom file of every single jar that I want and write an exclude > for that. At this point, I'm thinking, "Why am I using ivy in the first > place?" > > > Would greatly appreciate if someone would point out what I'm doing wrong. > > Thanks. > > > Perfect. Thanks. > > Also, to retrieve only jars and not source or javadocs, I figured this is a > better way: > In your build.xml, add a "type" qualifier for ivy:retrieve. (default takes > in all files!) > > > > > > > > > -- > View this message in context: > http://old.nabble.com/example-ivy---build.xml-file-for-spring-jsf-hibernate-project-tp22461453p28405448.html > Sent from the ivy-user mailing list archive at Nabble.com. > > -- Archie L. Cobbs --001485f1e36ed50e000485666622--