I recall suggesting on this list the introduction of an exclude-type attribute on post-resolve tasks (retrieve, cachepath, cachefileset). But certainly, the type attribute, which implicitly does an include, works as long as you know what types you want to include.
I do have to take issue one part of Steve's answer. While there's nothing literally wrong with it, I find the ivy:retrieve task to be an ungainly compromise geared toward users who don't quite embrace or trust Ivy. The retrieve task is introducing an extra middleman into the process by copying the files associated with a conf into a specified location when those files are already in the Ivy cache. So you have an extra set of files to maintain and invite synchronization/consistency problems with, which is only mitigated somewhat by the use of the sync attribute. Worse, inevitably if you're doing anything slightly complicated with Ivy, which you're going to have to do if you're using Ivy in a real-world scenario, those extra directories and trying to combine them just gets in the way. Instead, for Ant I'd recommend ivy:cachepath and ivy:cachefileset. On Mon, Oct 11, 2010 at 7:44 AM, Steve Miller <[email protected]> wrote: > <ivy:retrieve pattern="${lib.dir}/[conf]/[artifact].[ext]" sync="true" > type="jar" conf="*"/> > > Here's what I use. This task will pull all the artifacts for the most > recently called resolve command. > > - This pattern says, put all my retrieved artifact files in the lib > dir, under its conf folder. So libdir/compile/commons-lang.jar for > example. > - Using sync="true", it will delete old artifacts that were retrieved > on a previous retrieve before pulling the current. > - Using type="jar", I told it to only pull the jar files, not the > sources or other types of artifacts. > - Using conf="*" which says to retrieve the artifacts for all > configurations. Using the pattern above, you would end up with several > configuration folders under the lib dir. * is the default setting, so > the conf attribute can be excluded. > > After the retrieve, you are left with a bunch a folders under lib, > each which is a set of artifacts. So now in ant, it's easy to build a > classpath from the folder structure. > > <classpath> > <fileset dir="libdir"> > <include name="compile/*.jar"/> <!-- Where compile is the > configuration with the jars needed to compile --> > </fileset> > </classpath> > >
