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 Emmanuel Bourg <eb...@apache.org> on 2008/02/13 16:27:41 UTC

Commons Configuration and Ivy

Hi,

I just started playing with Ivy and tried retrieving the Commons 
Configuration artifact, but I noticed that Ivy keeps pulling the 
optional and test jars even if I only request the default jars. Here are 
the ivy.xml file and the Ant build I used:

<ivy-module version="2.0">
     <info organisation="test" module="test"/>
     <configurations>
         <conf name="default"/>
     </configurations>
     <dependencies>
         <dependency
             org="commons-configuration"
             name="commons-configuration"
             rev="1.4"
             conf="default"/>
     </dependencies>
</ivy-module>


<project name="test" default="go" xmlns:ivy="antlib:org.apache.ivy.ant">
     <target name="go">
         <ivy:retrieve conf="default"/>
     </target>
</project>

If I change for the 1.5 revision it's slightly better (junit and xerces 
are gone), but it still retrieves the optional jars such as 
servlet-api.jar, and it retrieves the test dependencies of 
commons-logging (log4j, logkit and avalon).

Is this a known issue or am I doing something wrong ?

Thanks for your help,

Emmanuel Bourg

Re: Commons Configuration and Ivy

Posted by Emmanuel Bourg <eb...@apache.org>.
Xavier Hanin a écrit :

> I think the problem comes from the metadata in the maven 2 repo:
> commons-configuration 1.4 depends on commons-jxpath 1.2 in scope compile,
> which in turn depends on servletapi 2.2 in scope compile too. According to
> maven 2 scope management documentation [1], it's normal you get servletapi
> with this metadata. I guess there are similar reasons for other
> dependencies. To understand why Ivy brings a dependency, I suggest
> generating the html report (alternatively you can simply go in your ivy
> cache root and open the xml report file with a web browser). This should
> help you understand why you'll need a lot of excludes when using maven 2
> repo...

Thank you, it's much clearer now. The dependencies of commons logging 
1.1 were not properly scoped, it has been fixed with the 1.1.1 release. 
So in this case, adding a first level dependency on commons logging 
1.1.1 in my module ensures that logkit and log4j are not retrieved.

There is something curious though, I looked at the pom for commons 
configuration 1.5, and the dependency on commons-logging is declared 
with an exclusion on logkit and avalon :

http://svn.apache.org/viewvc/commons/proper/configuration/tags/CONFIGURATION_1_5/pom.xml?view=markup

But the exclusion disappeared in the pom published in the Maven repository :

http://repo1.maven.org/maven2/commons-configuration/commons-configuration/1.5/commons-configuration-1.5.pom

I wonder what may have caused this.

Emmanuel Bourg

Re: Commons Configuration and Ivy

Posted by Xavier Hanin <xa...@gmail.com>.
On Feb 13, 2008 4:27 PM, Emmanuel Bourg <eb...@apache.org> wrote:

> Hi,
>
> I just started playing with Ivy and tried retrieving the Commons
> Configuration artifact, but I noticed that Ivy keeps pulling the
> optional and test jars even if I only request the default jars. Here are
> the ivy.xml file and the Ant build I used:
>
> <ivy-module version="2.0">
>     <info organisation="test" module="test"/>
>     <configurations>
>         <conf name="default"/>
>     </configurations>
>     <dependencies>
>         <dependency
>             org="commons-configuration"
>             name="commons-configuration"
>             rev="1.4"
>             conf="default"/>
>     </dependencies>
> </ivy-module>
>
>
> <project name="test" default="go" xmlns:ivy="antlib:org.apache.ivy.ant">
>     <target name="go">
>         <ivy:retrieve conf="default"/>
>     </target>
> </project>
>
> If I change for the 1.5 revision it's slightly better (junit and xerces
> are gone), but it still retrieves the optional jars such as
> servlet-api.jar, and it retrieves the test dependencies of
> commons-logging (log4j, logkit and avalon).
>
> Is this a known issue or am I doing something wrong ?

I think the problem comes from the metadata in the maven 2 repo:
commons-configuration 1.4 depends on commons-jxpath 1.2 in scope compile,
which in turn depends on servletapi 2.2 in scope compile too. According to
maven 2 scope management documentation [1], it's normal you get servletapi
with this metadata. I guess there are similar reasons for other
dependencies. To understand why Ivy brings a dependency, I suggest
generating the html report (alternatively you can simply go in your ivy
cache root and open the xml report file with a web browser). This should
help you understand why you'll need a lot of excludes when using maven 2
repo...

Xavier

>
>
> Thanks for your help,
>
> Emmanuel Bourg
>



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