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 cu...@gmail.com on 2009/11/13 17:42:25 UTC
Help understanding dependency element include w/ matcher
I have a module that has a dependency on a number of jar files which all
come from the same dependency. The artifacts are resolved using a packager
that expands a war file. Given that I do not control the number of
artifacts in the war I would like to use include elements that ask for all
artifacts of type jar.
This is how the dependency is coded in my ivy.xml:
<dependency name="com.sun.jersey" rev="1.0.2.0" >
<include name="*" matcher="glob" type="jar"/>
</dependency>
and when I run the build the resolve fails stating the file <resolver
path>/com.sun.jersey/1.0.2.0/jars/com.sun.jersey.jar cannot be resolved.
If I change the name attribute to include part of the name for a file I
knows exists, asm-3.1.jar, the resolve fails with the message:
ERROR: a required artifact is not listed by module descriptor: *#*!asm*.jar
<dependency name="com.sun.jersey" rev="1.0.2.0" >
<include name="asm*" matcher="glob" type="jar"/>
</dependency>
The question is am I using this feature correctly?
The documentation seems to support what I am trying (from Ivy dependency
include html page)
"the name of an artifact of the dependency module to add to the include
list, or an expression matching this name (see matcher attribute below)"
Thank you,
Pete
Re: Help understanding dependency element include w/ matcher
Posted by Mitch Gitman <mg...@gmail.com>.
Pete, I'm speaking a little off-the-cuff here because I don't quite have a
handle on your constraints, but this strikes me as a case where you're using
Ivy but you're not quite trusting Ivy.
For one thing, if the WAR in question is being built by your own build
system, then you have control over it. Instead of using a package resolver
to go into the JARs in WEB-INF/lib/, why not give your WAR project an
ivy.xml and make all those third-party modules dependencies? For example:
<dependency org="com.sun.jersey" name="jersey" rev="1.1.4" conf="runtime->*"
/>
This is presuming you have a conf called "runtime". You can then do an
ivy:cachepath against the "runtime" conf. Ivy's all about *transitive
*dependency
management, but resolving the JARs that have been physically placed in a WAR
is a case of nipping the transitivity in the bud.
The other thing that suggests you're not quite trusting Ivy is that you're
trying to include artifacts in your dependencies. Your dependent module's
ivy.xml should really be oblivious of the particular artifacts in its
dependencies. That's what the dependencies' own Ivy confs are there for--to
provide an abstraction layer to encapsulate the various artifacts being
published by those Ivy module.
This may be a case though where your hands are tied because you don't
control the Ivy files for your dependency modules. I didn't quite understand
the line: "The module that has the dependency is in a separate application
(even separate SCM system) and I am consuming the WAR as such."
Both these observations are predicated that you're going to go to the
trouble to create and publish Ivy modules with meaningful ivy.xml files for
your third-party dependencies. Obviously, my opinion is this is worth it,
even if it means changing the way you publish your upstream applications.
On Mon, Nov 16, 2009 at 6:17 AM, Peter Hale <cu...@gmail.com> wrote:
> Mitch,
>
>
> Thanks for replying.
> It does appear that I should be specifying com.sun.jersey as the org, but
> in
> our case the WAR file in question is produced by our build system and
> contains all of the pieces (JSR-311, asm, jersey jars, etc.) required by
> our
> application. The module that has the dependency is in a separate
> application
> (even separate SCM system) and I am consuming the WAR as such. I am using a
> packager resolver to expand the WAR so I can have access to its contents.
> What I need is the set of jars as a class path (using ivy:cachepath), but I
> do not want to specify the artifacts explicitly in the dependency.
>
> This is why I want to use the matcher attribute for the include.
>
> Thanks,
>
> Pete
>
>
Re: Help understanding dependency element include w/ matcher
Posted by Peter Hale <cu...@gmail.com>.
Mitch,
Thanks for replying.
It does appear that I should be specifying com.sun.jersey as the org, but in
our case the WAR file in question is produced by our build system and
contains all of the pieces (JSR-311, asm, jersey jars, etc.) required by our
application. The module that has the dependency is in a separate application
(even separate SCM system) and I am consuming the WAR as such. I am using a
packager resolver to expand the WAR so I can have access to its contents.
What I need is the set of jars as a class path (using ivy:cachepath), but I
do not want to specify the artifacts explicitly in the dependency.
This is why I want to use the matcher attribute for the include.
Thanks,
Pete
On Sat, Nov 14, 2009 at 11:33 PM, Mitch Gitman <mg...@gmail.com> wrote:
> Pete, one thing odd I notice about your dependency snippet is that you're
> specifying name="com.sun.jersey" but you're not specifying an org
> attribute.
> And actually, it looks like "com.sun.jersey" is really your org in this
> case, not the module as specified by the name attribute you're using.
>
> Just try changing that one attribute from name to org and see what happens.
>
> I don't quite understand what you mean when you write: "The artifacts are
> resolved using a packager that expands a war file. Given that I do not
> control the number of artifacts in the war..." Ideally, if you do control
> the thing you depend on, you wouldn't be sifting through the artifacts to
> include via the include in the dependent module. Instead, you would be
> encapsulating those different artifacts' inclusion behind confs in the
> depended-upon module itself.
>
> On Fri, Nov 13, 2009 at 10:40 AM, Peter Hale <cu...@gmail.com> wrote:
>
> > I have a module that has a dependency on a number of jar files which all
> > come from the same dependency. The artifacts are resolved using a
> packager
> > that expands a war file. Given that I do not control the number of
> > artifacts
> > in the war I would like to use include elements that ask for all
> artifacts
> > of type jar.
> >
> > This is how the dependency is coded in my ivy.xml:
> >
> > <dependency name="com.sun.jersey" rev="1.0.2.0" >
> > <include name="*" matcher="glob" type="jar"/>
> > </dependency>
> >
> > and when I run the build the resolve fails stating the file <resolver
> > path>/com.sun.jersey/1.0.2.0/jars/com.sun.jersey.jar cannot be resolved.
> >
> > If I change the name attribute to include part of the name for a file I
> > knows exists, asm-3.1.jar, the resolve fails with the message:
> >
> > ERROR: a required artifact is not listed by module descriptor:
> *#*!asm*.jar
> >
> > <dependency name="com.sun.jersey" rev="1.0.2.0" >
> > <include name="asm*" matcher="glob" type="jar"/>
> > </dependency>
> >
> > The question is am I using this feature correctly?
> >
> > The documentation seems to support what I am trying (from Ivy dependency
> > include html page)
> >
> > "the name of an artifact of the dependency module to add to the include
> > list, or an expression matching this name (see matcher attribute below)"
> >
> > Thank you,
> >
> > Pete
> >
>
Re: Help understanding dependency element include w/ matcher
Posted by Mitch Gitman <mg...@gmail.com>.
Pete, one thing odd I notice about your dependency snippet is that you're
specifying name="com.sun.jersey" but you're not specifying an org attribute.
And actually, it looks like "com.sun.jersey" is really your org in this
case, not the module as specified by the name attribute you're using.
Just try changing that one attribute from name to org and see what happens.
I don't quite understand what you mean when you write: "The artifacts are
resolved using a packager that expands a war file. Given that I do not
control the number of artifacts in the war..." Ideally, if you do control
the thing you depend on, you wouldn't be sifting through the artifacts to
include via the include in the dependent module. Instead, you would be
encapsulating those different artifacts' inclusion behind confs in the
depended-upon module itself.
On Fri, Nov 13, 2009 at 10:40 AM, Peter Hale <cu...@gmail.com> wrote:
> I have a module that has a dependency on a number of jar files which all
> come from the same dependency. The artifacts are resolved using a packager
> that expands a war file. Given that I do not control the number of
> artifacts
> in the war I would like to use include elements that ask for all artifacts
> of type jar.
>
> This is how the dependency is coded in my ivy.xml:
>
> <dependency name="com.sun.jersey" rev="1.0.2.0" >
> <include name="*" matcher="glob" type="jar"/>
> </dependency>
>
> and when I run the build the resolve fails stating the file <resolver
> path>/com.sun.jersey/1.0.2.0/jars/com.sun.jersey.jar cannot be resolved.
>
> If I change the name attribute to include part of the name for a file I
> knows exists, asm-3.1.jar, the resolve fails with the message:
>
> ERROR: a required artifact is not listed by module descriptor: *#*!asm*.jar
>
> <dependency name="com.sun.jersey" rev="1.0.2.0" >
> <include name="asm*" matcher="glob" type="jar"/>
> </dependency>
>
> The question is am I using this feature correctly?
>
> The documentation seems to support what I am trying (from Ivy dependency
> include html page)
>
> "the name of an artifact of the dependency module to add to the include
> list, or an expression matching this name (see matcher attribute below)"
>
> Thank you,
>
> Pete
>
Help understanding dependency element include w/ matcher
Posted by Peter Hale <cu...@gmail.com>.
I have a module that has a dependency on a number of jar files which all
come from the same dependency. The artifacts are resolved using a packager
that expands a war file. Given that I do not control the number of artifacts
in the war I would like to use include elements that ask for all artifacts
of type jar.
This is how the dependency is coded in my ivy.xml:
<dependency name="com.sun.jersey" rev="1.0.2.0" >
<include name="*" matcher="glob" type="jar"/>
</dependency>
and when I run the build the resolve fails stating the file <resolver
path>/com.sun.jersey/1.0.2.0/jars/com.sun.jersey.jar cannot be resolved.
If I change the name attribute to include part of the name for a file I
knows exists, asm-3.1.jar, the resolve fails with the message:
ERROR: a required artifact is not listed by module descriptor: *#*!asm*.jar
<dependency name="com.sun.jersey" rev="1.0.2.0" >
<include name="asm*" matcher="glob" type="jar"/>
</dependency>
The question is am I using this feature correctly?
The documentation seems to support what I am trying (from Ivy dependency
include html page)
"the name of an artifact of the dependency module to add to the include
list, or an expression matching this name (see matcher attribute below)"
Thank you,
Pete