On Tue, Apr 28, 2009 at 5:04 PM, Alan Chaney <[email protected]> wrote:
> I wouldn't claim to be an Ivy expert, but I have had a similar problem.
>
> You don't say how your ivy:retrieve is configured. Ivy is fundamentally a
> two step process:
>
> 1. Resolve the *project* dependencies required (which puts them in the ivy
> cache)
> 2. Retrieve the artifacts to a location you specify.
>
> You can bypass step2 by configuring your classpath to include the
> ivy:cachepath output for compiles etc, but you normally need to retrieve
> them when building and deploying your own artifacts.
>
> I suspect that you using ivy:retrieve to place your depedency artifacts in
> a local location (such as a 'lib' folder) and that what is happening is that
> the 'old' versions are still there when you retrieve a later version. I had
> a similar problem assembling jars for a war file, and found that what I need
> to do was to simply clear the target folder using an Ant 'delete' task,
> configured appropriately of course.
>
> Or, I may have completely misunderstood what it is that you doing, in which
> case I apologize!
>
> Regards
>
> Alan Chaney
Hi Alan,
Thanks for your reply.
I'm terrible at posting to these lists, so I apologise for not describing my
situation better.
My ant task, aptly named 'get-dependencies' does the following:
<target name="get-dependencies" >
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="classpath-support"/>
<ivy:settings file="./ivysettings.xml" />
<ivy:retrieve log="${ivy.loglevel}" />
</target>
Currently there are no project-specific dependencies, just artifacts (JARs).
What you're describing does seem to relate to what I'm doing, but I actually
don't want to delete the lib directory as we're in a large team here and I'd
like dependency management to be as transparent as possible - some people
may have be using a lib dir for a dependency not currently configured in
Ivy.
What I've been looking at over the past few hours (!!!) is the conflict
element in an IVY file and the latest-revision strategy and relevant
conflict manager. I'm assuming that this applies to artifact resolution, as
they still have an org and a module. Unfortunately I haven't had any luck
and I've actually come across an issue where Ivy's schema validation for my
ivy.xml is invalid when using the <conflict> element. I'll ignore that for
now as I'm 99% sure it's just my misunderstanding ( Invalid content was
found starting with element 'dependency'. One of '{conflict}' is expected.
etc). I was hoping that the duplicate JAR files (some-build-123.jar and
some-build-124.jar) would trigger a conflict but no such thing occured.
I've attached my ivy.xml and ivysettings.xml file for reference - perhaps
it'll shed some more light on what I'm doing wrong.
Cheers,
--
Alex Collins
<ivy-module version="2.0">
<info organisation="someCompany" module="someCompany.com">
<description>Retrieves JAR files for internal (e.g. utilities) and
external (e.g. Apache commons) dependencies.
</description>
</info>
<dependencies>
<!-- jars or projects we depend on -->
<dependency org="someCompany" name="utilities-build" rev="125" />
<dependency org="someCompany" name="some-build" rev="1314" />
<!-- end jars -->
<!-- ivy will translate the dot notation to slashes e.g. javax.mail to javax/mail for purposes of dependency retrieval -->
<dependency org="antlr" name="antlr" rev="2.7.6" />
<dependency org="asm" name="asm" rev="1.5.3" />
<dependency org="asm" name="asm-attrs" rev="1.5.3" />
<dependency org="org.aspectj" name="aspectjweaver" rev="1.5.4" />
<dependency org="axis" name="axis-ant" rev="1.2.1" />
<dependency org="axis" name="axis-schema" rev="1.3" />
<dependency org="axis" name="axis" rev="1.3" />
<dependency org="backport-util-concurrent" name="backport-util-concurrent" rev="3.0" />
<dependency org="commons-beanutils" name="commons-beanutils" rev="1.6" />
<dependency org="commons-codec" name="commons-codec" rev="1.3" />
<dependency org="commons-collections" name="commons-collections" rev="2.1.1" />
<dependency org="commons-dbcp" name="commons-dbcp" rev="1.2.2" />
<dependency org="commons-digester" name="commons-digester" rev="1.8" />
<dependency org="commons-discovery" name="commons-discovery" rev="0.2" />
<dependency org="commons-fileupload" name="commons-fileupload" rev="1.0" />
<dependency org="commons-httpclient" name="commons-httpclient" rev="3.0.1" />
<dependency org="commons-lang" name="commons-lang" rev="2.4" />
<dependency org="commons-logging" name="commons-logging" rev="1.0.4" />
<dependency org="commons-net" name="commons-net" rev="1.4.1" />
<dependency org="commons-pool" name="commons-pool" rev="1.3" />
<dependency org="commons-validator" name="commons-validator" rev="1.1.4" />
<dependency org="javax.activation" name="activation" force="true" rev="1.1" />
<dependency org="javax.mail" name="mail" force="true" rev="1.1" />
<dependency org="javax.xml" name="jaxrpc" rev="1.1" />
<dependency org="javax.xml" name="jaxrpc-api" rev="1.1" />
<dependency org="jdom" name="jdom" rev="1.0" />
<dependency org="log4j" name="log4j" rev="1.2.8" />
<dependency org="newqas" name="newqas" rev="0" />
<dependency org="ojdbc" name="ojdbc" rev="14" />
<dependency org="xerces" name="xerces" rev="2.4.0" />
<dependency org="org.springframework" name="spring" rev="2.5.1" />
<dependency org="org.apache.xmlbeans" name="xmlbeans" rev="2.3.0" />
</dependencies>
<conflicts>
<manager name="latest-revision-cm" />
</conflicts>
</ivy-module>
<ivysettings>
<properties file="build.properties" />
<settings defaultResolver="chain-internal" />
<caches default="local-cache">
<cache name="local-cache" basedir="${repository.local}" />
</caches>
<latest-strategies>
<latest-revision name="latest-revision-strategy" usedefaultspecialmeanings="true" />
</latest-strategies>
<conflict-managers>
<latest-cm name="latest-revision-cm" latest="latest-revision-strategy" />
</conflict-managers>
<resolvers>
<chain name="chain-internal">
<!-- resolves dependencies internally in the following order:
1) build.properties: repository.local
2) build.properties: repository.remote
3) Maven repository
4) Second maven repository (different subdomain)
-->
<filesystem name="internal-libs-local">
<artifact pattern="${repository.local}/[artifact].[revision].[ext]" />
</filesystem>
<filesystem name="internal-libs-remote">
<artifact pattern="${repository.remote}/[artifact].[revision].[ext]" />
</filesystem>
<!-- The following are remote repositories on the net - use them in dire circumstances -->
<!-- <url name="maven-repository" m2compatible="true"> -->
<!-- <artifact pattern="http://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/> -->
<!-- </url> -->
<!-- <url name="maven-repository2" m2compatible="true"> -->
<!-- <artifact pattern="http://repo2.maven.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/> -->
<!-- </url> -->
</chain>
</resolvers>
<modules>
<!-- Force all dependency resolution to use our chain defined above -->
<module organisation="*" name="*" resolver="chain-internal" />
</modules>
</ivysettings>