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 limbicsystem <li...@gmail.com> on 2008/01/23 23:51:51 UTC

"extra" attributes lost when dependencies are placed into cache

Hi,

I'm making use of the "extra" attributes in <dependency> in order to lay out
staging directories for my artifacts.  For example, I have a project that
generates an ear file.  It needs to place its dependencies in particular
subdirs in the ear; some dependencies go in "APP-INF/lib", others go in
"services".  I accomplish this by setting a target.dir attribute in my ear
project's dependencies, like so:

   <dependency rev="${myapp.version}"
               name="some-lib"
               org="my-company"
               conf="compile->default;runtime->default"
               target.dir="APP-INF/lib"/>

   <dependency rev="${myapp.version}"
               name="another-lib"
               org="my-company"
               conf="compile->default;runtime->default"
               target.dir="services"/>

Then I use ivy:retrieve to place my deps in the proper layout in my staging
area:

        <ivy:retrieve validate="false" organisation="${org}"
module="${ant.project.name}"
                      useOrigin="true"
                     
pattern="${staging.dir}/[conf]/([target.dir]/)[artifact].[ext]"
sync="false"/>


This works fine- I get a dir that looks like:

                      staging.dir/runtime/APP-INF/lib/some-lib.jar
                      staging.dir/runtime/services/another-lib.jar

However, the "target.dir" attribute only seems to take effect when my ivy
cache is empty- the initial retrieve works as expected, but subsequent
retrieves seem to ignore target.dir, as if it were undefined for each dep. 
All my deps end up in staging.dir/runtime.  If I do a cleancache, retrieve
works properly again.

I suspect that what is happening is when my dependencies' metadata gets
placed into the Ivy cache, it does not have any target.dir attributes (this
is logical, since these are defined in the ear project, not the
dependencies' ivy.xmls).  But when these artifacts are then found in the
cache, "target.dir" is undefined, and this somehow causes its value to be
disregarded in my ear's ivy.xml.  

I'm using Ivy 2.0.0-beta2-local-20080103173107.  Thanks in advance for your
time.




-- 
View this message in context: http://www.nabble.com/%22extra%22-attributes-lost-when-dependencies-are-placed-into-cache-tp15054739p15054739.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: "extra" attributes lost when dependencies are placed into cache

Posted by Xavier Hanin <xa...@gmail.com>.
On Jan 23, 2008 11:51 PM, limbicsystem <li...@gmail.com> wrote:

>
> Hi,
>
> I'm making use of the "extra" attributes in <dependency> in order to lay
> out
> staging directories for my artifacts.  For example, I have a project that
> generates an ear file.  It needs to place its dependencies in particular
> subdirs in the ear; some dependencies go in "APP-INF/lib", others go in
> "services".  I accomplish this by setting a target.dir attribute in my ear
> project's dependencies, like so:
>
>   <dependency rev="${myapp.version}"
>               name="some-lib"
>               org="my-company"
>               conf="compile->default;runtime->default"
>               target.dir="APP-INF/lib"/>
>
>   <dependency rev="${myapp.version}"
>               name="another-lib"
>               org="my-company"
>               conf="compile->default;runtime->default"
>               target.dir="services"/>
>
> Then I use ivy:retrieve to place my deps in the proper layout in my
> staging
> area:
>
>        <ivy:retrieve validate="false" organisation="${org}"
> module="${ant.project.name}"
>                      useOrigin="true"
>
> pattern="${staging.dir}/[conf]/([target.dir]/)[artifact].[ext]"
> sync="false"/>
>
>
> This works fine- I get a dir that looks like:
>
>                      staging.dir/runtime/APP-INF/lib/some-lib.jar
>                      staging.dir/runtime/services/another-lib.jar
>
> However, the "target.dir" attribute only seems to take effect when my ivy
> cache is empty- the initial retrieve works as expected, but subsequent
> retrieves seem to ignore target.dir, as if it were undefined for each dep.
> All my deps end up in staging.dir/runtime.  If I do a cleancache, retrieve
> works properly again.
>
> I suspect that what is happening is when my dependencies' metadata gets
> placed into the Ivy cache, it does not have any target.dir attributes
> (this
> is logical, since these are defined in the ear project, not the
> dependencies' ivy.xmls).  But when these artifacts are then found in the
> cache, "target.dir" is undefined, and this somehow causes its value to be
> disregarded in my ear's ivy.xml.
>
> I'm using Ivy 2.0.0-beta2-local-20080103173107.  Thanks in advance for
> your
> time.

This is strange, and really sounds like a bug. Have you checked your cache
to see how the Ivy files looks like in your cache?

BTW, you can also try a more recent build, we have implemented IVY-553
recently, and thus changed somehow how extra attributes are handled.

Xavier

>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/%22extra%22-attributes-lost-when-dependencies-are-placed-into-cache-tp15054739p15054739.html
> Sent from the ivy-user mailing list archive at Nabble.com.
>
>


-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/