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 Thu, 08 Jan 2009 17:08:48 GMT
I'm glad to see you worked it out; my solution wasn't quite right for
your situation. To understand configurations better, read the tutorial:
http://ant.apache.org/ivy/history/trunk/tutorial/conf.html
About halfway down is an explanation of the -> token in dependency conf
attributes.

-----Original Message-----
From: hezjing [mailto:hezjing@gmail.com] 
Sent: Wednesday, January 07, 2009 6:57 AM
To: ivy-user@ant.apache.org
Subject: Re: How to download only the required JARs?

Hi Partridge

I was trying in wild and finally the following Ivy configuration is
working!

<ivy-module version="2.0">
  <info organisation="com.dummy" module="hello" />
  <configurations>
    <conf name="build" />
    <conf name="runtime" extends="build" />
  </configurations>
  <dependencies>
    <dependency org="org.slf4j" name="slf4j-api" rev="1.5.6"
conf="build->default">
    </dependency>
    <dependency org="ch.qos.logback" name="logback-classic" rev="0.9.14"
conf="runtime->default">
      <exclude org="javax.mail" />
      <exclude org="janino" />
      <exclude org="org.apache.geronimo.specs" />
      <exclude org="javax.servlet" />
    </dependency>
  </dependencies>
</ivy-module>


but I'm not sure if you were talking about the same configuration?

I don't know why it doesn't work when conf="build",
but conf="build->default",
kinda difficult to understand the concept of module configuration :-(


On Wed, Jan 7, 2009 at 9:04 AM, hezjing <hezjing@gmail.com> wrote:

> Hi Partridge
> I understand your explanation except to replace conf1 with the
logback's
> configuration that provides slf4j-api,
> and replace conf2 with the configuration which provides logback-core
> and logback-classic jars.
>
> conf1 and conf2 are something we need to define ourself?
>
> Would you be able to show me an example?
>
>
> Thank you!
>
>
> On Wed, Jan 7, 2009 at 1:16 AM, Partridge, Michael <
> Michael.Partridge@shps.com> wrote:
>
>> 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<http://ant.apache.org/ivy/history/latest-milestone/ivyfile/arti
fact-exclude.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.
>>
>
>
>
> --
>
> Hez
>



-- 

Hez

Mime
View raw message