ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kirby Files <kfi...@masergy.com>
Subject Re: Configurations and Ivy file confusion
Date Thu, 23 Apr 2009 13:44:59 GMT
Tom wrote on 04/23/2009 02:41 AM:
>
>> A module defines one or more configurations, which will be used to
>> meet different needs. For example, the logging framework slf4j defines
>> a "core" configuration, which includes only the API jar. It then has a
>> configs for each implementation choice a user might want, "log4j",
>> "jul", "jcl", etc.
>
> That actually makes sense. :-) So it is a qualifier, though up by the
> developer. Is there some central place where one can find these
> qualifiers? Like the pom.xml in the Maven repositories?

I'm not sure that the Maven poms usually specify a scope. Some may, 
but many may not. For high-quality Ivy modules, I recommend Ivy Roundup:
   http://code.google.com/p/ivyroundup/

> So what would be the appropriate way to split-up the set. As said: I
> want to split between between what is required at compiletime, test and
> runtime. The leading example would be that junit should not be present
> in lib but lib-test.

I typically have some configurations like the following:
         <conf name="default" transitive="true" visibility="public" />
         <conf name="runtime" transitive="true" visibility="public" />
         <conf name="compile" extends="deploy" transitive="true" 
visibility="private" />
         <conf name="test" extends="deploy" transitive="true" 
visibility="private" />
         <conf name="sources" transitive="true" visibility="public" />
         <conf name="javadocs" transitive="true" visibility="public" />

The public configurations are there for me to define publications 
which will be visible to other modules. The private ones are just for 
specifying dependencies during my different phases of 
compile/test/run. For compile and test, I generally need everything 
required by runtime (so I extend that config), plus some extra 
libraries (like junit for testing or servlet-api for compilation).

> Appearantly I did something wrong. Running "ivy:retrieve" now downloads
> 94 jars. Ok. However, if I I now want to split up like this:
>
> <ivy:retrieve conf="runtime" pattern="lib/[artifact]-[revision].[ext]"/>
> <ivy:retrieve conf="test" pattern="lib-test/[artifact]-[revision].[ext]"/>
> <ivy:retrieve conf="build" pattern="lib-ext/[artifact]-[revision].[ext]"/>
>
> Then I get an error
>
> /BUILD FAILED
> C:\Documents and Settings\User\My
> Documents\kpprofiler2\components\service\build.xml:39: impossible to ivy
> retrieve: java.lang.RuntimeException: problem during
> retrieve of nl.knowledgeplaza#kpprofiler-service:
> java.lang.RuntimeException: Multiple artifacts of the module
> org.codehaus.enunciate#enunciate-rt;1.10 are ret
> ieved to the same file! Update the retrieve pattern to fix this error.
> /

OK, many projects have source and jar artifacts with the same name, so 
you really want to either set a retrieve pattern which includes the 
type of the artifact for disambiguation. If you cannot do this, you'll 
need to specify an exclusion rule for your dependencies to only 
include type jar. Here are examples of both:

         <ivy:retrieve 
pattern="${ivy.lib.dir}/[type]/[artifact]-[revision].[ext]" 
haltonfailure="true" conf="build" sync="true"/>

         <dependencies>
           <exclude type="source"/>
         </dependencies>

Thanks,
---
Kirby Files
Software Architect
Masergy Communications
kfiles@masergy.com

Mime
View raw message