You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by "andy@far2gone.com" <an...@far2gone.com> on 2014/01/28 14:40:42 UTC

maven classifier on ant install task

Hi,

I've been having a go at using the Ivy Install ant task to create a local
repository based on libraries downloaded from maven central.

Having gone along with the tutorial, all seemed to be working :)

Until...

One of the dependencies in my project is json-lib.

It seems that the json-lib project uses a maven classifier to discriminate
between jars suitable for different versions of the jvm.

If I were just declaring a dependency I think I could do this:

<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>

However, I'm using install tasks that look like:

<ivy:install organisation="log4j" module="log4j" revision="1.2.17" from="chain"
to="fs1" transitive="true" overwrite="true"/>

How should I declare the "classifier" on an "install" task?

Thanks, Andy

Re: maven classifier on ant install task

Posted by David Weintraub <qa...@gmail.com>.
There are a couple of things you need:

* You need to add the following line to the top of your ivy.xml file:

<ivy-module version="1.0"  xmlns:maven="http://maven.apache.org">

Note the "xmlns" declaration. It doesn't matter where it points to (I like using the URL of the project), you just need to declare the namespace.

* Now, you can use that Maven classifier in your dependency declaration:

	<dependency org="net.sf.json-lib"
 		name="json-lib" 
		rev="2.4"
		conf="compile->default">
		<artifact name="json-lib"
			type="jar" 
			ext="jar" 
			maven:classifier="jdk15"/>
	</dependency>


--
David Weintraub
qazwart@gmail.com

================================================
Sure, call me crazy. They called Eddie Antar crazy too, but
look at these low, low prices on all of these famous name brand appliances.


On Jan 28, 2014, at 8:40 AM, andy@far2gone.com wrote:

> Hi,
> 
> I've been having a go at using the Ivy Install ant task to create a local
> repository based on libraries downloaded from maven central.
> 
> Having gone along with the tutorial, all seemed to be working :)
> 
> Until...
> 
> One of the dependencies in my project is json-lib.
> 
> It seems that the json-lib project uses a maven classifier to discriminate
> between jars suitable for different versions of the jvm.
> 
> If I were just declaring a dependency I think I could do this:
> 
> <dependency>
> <groupId>net.sf.json-lib</groupId>
> <artifactId>json-lib</artifactId>
> <version>2.4</version>
> <classifier>jdk15</classifier>
> </dependency>
> 
> However, I'm using install tasks that look like:
> 
> <ivy:install organisation="log4j" module="log4j" revision="1.2.17" from="chain"
> to="fs1" transitive="true" overwrite="true"/>
> 
> How should I declare the "classifier" on an "install" task?
> 
> Thanks, Andy