The deliver task does not publish, it only updates the ivy file for
delivery, replacing some metadata information. To publish I suggest having a
look at the publish task code, which does something like this:
ivy.publish(mrid, artifactspattern, publishResolverName,
new PublishOptions()
.setPubrevision(getPubrevision())
.setCache(CacheManager.getInstance(settings, cache))
.setSrcIvyPattern(publishivy ? srcivypattern : null)
.setStatus(getStatus())
.setPubdate(pubdate)
.setExtraArtifacts((Artifact[]) artifacts.toArray(new Artifact[
artifacts.size()]))
.setValidate(doValidate(settings))
.setOverwrite(overwrite)
.setUpdate(update)
.setConfs(splitConfs(conf)));
This should give you a pretty good idea of the options you have to call
publish yourself.
Xavier
On Nov 26, 2007 2:19 PM, teknokrat <[EMAIL PROTECTED]> wrote:
> I am writing some code to publish jars using a filesystem resolver for a
> plugin. So far I have tried
>
> String path = IvyPatternHelper.substitute("", organisation, module,
> revision, "ivy", "ivy", "xml");
> File ivyFile = new File(path);
> if (!ivyFile.exists()) {
> IvyDeliver deliver = new IvyDeliver();
> deliver.setModule(module);
> deliver.setOrganisation(organisation);
> deliver.setRevision(revision);
> deliver.execute();
> }
>
> This throws NPEs. How can I use the Ivy API to publish a jar file from a
> java program? What fields are mandatory and how do i add the
> configuration details? There does not appear to be any javadoc link on
> the main site.
>
> cheers
>
>
--
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/