ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Mark.Ro...@wellsfargo.com>
Subject Conf help with separate lib directories, duplicate jars downloaded based on different confs
Date Tue, 08 Jan 2008 22:05:15 GMT

I am prototyping using Ivy on a project. The project has many components
that depend on each other.

The intent is to have project lib folders split out what a project needs
to compile, what it needs at runtime, etc.  I am real close but am
having one final issue.

Ant 1.7.0
Ivy 2.0.0-beta

Configurations defined as:
		<conf name="api" visibility="public" description="API
this component provides"/>
		<conf name="compile" visibility="public"
description="Things this component needs to compile"/>
		<conf name="runtime" visibility="public"
description="Things required in the runtime."/>
		<conf name="provided" visibility="public"
description="places to put j2ee things that should be provided by the
container"/>
		<conf name="build" visibility="public" description="this
for tools only used in building - i.e. antlibs, wsdl to java converters,
etc, "/>
		<conf name="test" visibility="private" description="only
used in testing."/>

2 example components  Comp1 and Comp2

Comp1  1 has the following in the ivy.xml
	<publications>
		<artifact name="comp1" type="jar" conf="api"/>
		<artifact name="comp1-src" type="source" ext="zip"
conf="api"/>
	</publications>
	
	<dependencies>
		<dependency org="log4j" name="log4j" rev="1.2.14"
conf="compile->default" />
		<dependency org="javax.servlet" name="servlet-api"
rev="2.4" conf="provided->default" />
		<!-- unit test -->
		<dependency org="junit" name="junit" rev="3.8.1"
conf="test->default"/>
	</dependencies>

Comp2 has the following defined:
	<publications>
		<artifact name="comp2" type="jar" conf="api"/>
		<artifact name="comp2-src" type="source" ext="zip"
conf="api"/>
	</publications>
	
	<dependencies>
		<dependency org="example" name="comp1" rev="1.1.1"
conf="compile->api; runtime->compile,runtime; provided->provided" />
		<dependency org="log4j" name="log4j" rev="1.2.14"
conf="compile->default" />
		<!-- unit test -->
		<dependency org="junit" name="junit" rev="3.8.1"
conf="test->default"/>
		
	</dependencies>

The build.xml segment to update the libs is as follows:
<target name="component-refresh-lib" depends="init" description="-->
refresh lib directory with ivy">
		<ivy:retrieve  type="jar" sync="true"
pattern="${ivy.lib.dir}/[conf]/[artifact]-[revision].[ext]" />
		<ivy:retrieve type="source" sync="true"
pattern="${ivy.lib.dir}/src-lib/[artifact]-[revision].[ext]"/>
		
	</target>


In this scenario, comp2 also uses log4j directly, so it is in the
compile conf of comp2.  It also mapped to comp2's runtime config by the
fact that anything comp1 depends on for compile, needs to be in the
runtime of comp2.

My issue:
I currently get a directory structure/contents that looks like:
lib/compile/comp1-1.1.1.jar
lib/compile/log4j-1.2.4.jar
lib/provided/servlet-api-2.4.jar
lib/runtime/log4j-1.2.14.jar
lib/test/juni-3.8.1.jar
lib/src-lib/comp1-src-1.1.1.zip

How do I stop the lib/runtime/log4j-1.2.14-jar from showing up in the
runtime?  The fact that comp2 directly uses log4j, I want to have that
show up only in the compile directory.  

I would also want the "normal" version resolution happening so that if
the comp1 depends on version log4j-1.2.13.jar, it not downloaded because
log4j-1.2.14 is directly used.


Thanks in advance

Mark





Mime
View raw message