I'll try this again without the long folksy preliminaries (see copied below).

I need to get an artifact that uses a M2 classifier. How do I do that using the Ivy Ant tasks?

Thanks!

Jim

Jim White wrote:

Hello Xavier and friends!

I've been lurking around Ivy for a long while and am glad to see it close to being released as Apache Ant software.

Today I tried to sort out a problem someone was having using JSON-lib with Groovy and ran smack into a M2 classifier. So I workaround it sort of this way:

XWINGS.IVY {
   info(organisation:"org.ifcx", module:"WingsIvyTest")
   dependencies {
       dependency(org:'net.sf.json-lib', name:'json-lib', rev:'2.2.1'
                  , conf:'default->runtime') {
           artifact(name:'json-lib', type:'jar',
url:'http://repo1.maven.org/maven2/net/sf/json-lib/json-lib/2.2.1/json-lib-2.2.1-jdk15.jar')
       }
   }
}

Naturally that is not so satisfying, so then I see this ("Re: How can I retrieve binary files and source files in one shot"):

http://marc.info/?l=ivy-user&m=119939232121568&w=2

which makes me think, Aha! but alas no joy because if I try to make an Ivy like that I get:

XWINGS.IVY {
   info(organisation:"org.ifcx", module:"WingsIvyTest")
   dependencies {
dependency(org:'net.sf.json-lib', name:'json-lib', rev:'2.2.1', conf:'default->runtime') {
           artifact(name:'json-lib', type:'jar', classifier:'jdk15')
       }
   }
}
: syntax errors in ivy file: java.text.ParseException: [xml parsing: file:/tmp/ifcx-wings-ivy-23918.xml:5:65: cvc-complex-type.3.2.2: Attribute 'classifier' is not allowed to appear in element 'artifact'. in file:/tmp/ifcx-wings-ivy-23918.xml
]

Same problem if I try that in 'dependency'. I look into the ivy.xsd in SVN and see that indeed there is no 'classifier' anywhere, nor is there in the related Java files.

I then find the ResolveTest.java code which uses a classifier in a POM which it hands off to ivy.resolve(File), and so I think Aha! again and set about trying to give the Ivy Ant resolve task a POM, but that doesn't seem to be working out either, although perhaps I just need to do further debugging.

Is it possible to use a POM with the Ivy Ant tasks? What do I need to do to use a classifier from the Ant tasks? It's possible I could use the Ivy Java API, but I'm trying to avoid tying my implementation too closely to Ivy's internals and Ant tasks are preferred.

Thanks in advance for any pointers.

And if you want to get a peek at Ivy integrated with Groovy inside OpenOffice, you can try it out here:

http://www.ifcx.org/

It's the "IFCX Wings" literate scripting document that is enabled by GroovyForOpenOffice, but you can just look at the document without using G4OO for the macro.

Jim



Reply via email to