ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Partridge, Michael" <Michael.Partri...@shps.com>
Subject RE: How to download only the required JARs?
Date Tue, 06 Jan 2009 17:16:50 GMT
You can exclude the jars you don't want using the exclude element [1]
within dependency:

  <configurations>
    <conf name="build" visibility="private" description="compilation
only need jar" />
    <conf name="runtime" visibility="private" extends="build"
description="all runtime jars" />
  </configurations>
  <dependencies>
    <dependency org="ch.qos.logback" name="logback-classic" rev="0.9.14"
conf="build->conf1;runtime->conf2"/>
      <exclude org="javax.mail" />
      <!-- etc -->
    </dependency>
  </dependencies>

where, in the conf attribute of the dependency element, you would
replace conf1 with the logback's configuration that provides slf4j-api,
and conf2 with the configuration which provides logback-core and
logback-classic jars.

[1]
http://ant.apache.org/ivy/history/latest-milestone/ivyfile/artifact-excl
ude.html

-----Original Message-----
From: hezjing [mailto:hezjing@gmail.com] 
Sent: Tuesday, January 06, 2009 10:26 AM
To: ivy-user@ant.apache.org
Subject: How to download only the required JARs?

Hi
I want to test Logback.

Without Ivy, my project has one compile JAR:
lib/slf4j-api-1.5.6.jar

and two runtime JARs:

lib/logback-core-0.9.14.jar
lib/logback-classic-0.9.14.jar


With Ivy, I configured the following ivy.xml:

<ivy-module version="1.0">
  <info organisation="com.dummy" module="hello" />
  <configurations>
    <conf name="build" visibility="private" description="compilation
only
need jar" />
  </configurations>
  <dependencies>
    <dependency org="ch.qos.logback" name="logback-classic" rev="0.9.14"
/>
  </dependencies>
</ivy-module>


and here is the Ant's task to download the dependencies:

  <target name="resolve" description="retrieve dependencies">
    <ivy:retrieve pattern="${lib}/[conf]/[artifact].[ext]" />
  </target>


Do you know why when Ant run, it start downloading the following JARs?
....
[ivy:retrieve]  found ch.qos.logback#logback-classic;0.9.14 in public
[ivy:retrieve]  found ch.qos.logback#logback-core;0.9.14 in public
[ivy:retrieve]  found org.slf4j#slf4j-api;1.5.6 in public
[ivy:retrieve]  found javax.mail#mail;1.4 in public
[ivy:retrieve]  found javax.activation#activation;1.1 in public
[ivy:retrieve]  found janino#janino;2.4.3 in public
[ivy:retrieve]  found
org.apache.geronimo.specs#geronimo-jms_1.1_spec;1.0 in
public
[ivy:retrieve]  found javax.servlet#servlet-api;2.5 in public
....


What I want to do is to configure a 'build' configuration, that gives
me slf4j-api-1.5.6.jar
and a 'runtime' configuration, that gives me logback-core-0.9.14.jar
and logback-classic-0.9.14.jar (which also extends the 'build'
configuration)?



-- 

Hez

-----------------------------------------
CONFIDENTIALITY NOTICE: This electronic message transmission is
intended only for the person or the entity to which it is addressed
and may contain information that is privileged, confidential or
otherwise protected from disclosure. If you have received this
transmission, but are not the intended recipient, you are hereby
notified that any disclosure, copying, distribution or use of the
contents of this information is strictly prohibited. If you have
received this e-mail in error, please contact the sender of the
e-mail and destroy the original message and all copies.

Mime
View raw message