File ivyFile = new File(_cache, IvyPatternHelper.substitute(_srcivypattern, _organisation, _module, _pubRevision, "ivy", "ivy", "xml"));
File ivyFile = new File(IvyPatternHelper.substitute(_srcivypattern, _organisation, _module, _pubRevision, "ivy", "ivy", "xml"));
    public void execute() throws BuildException {        Ivy ivy = getIvyInstance();        _organisation = getProperty(_organisation, ivy, "ivy.organisation");        _module = getProperty(_module, ivy, "ivy.module");        _revision = getProperty(_revision, ivy, "ivy.revision");        _pubRevision = getProperty(_pubRevision, ivy, "ivy.deliver.revision");        if (_cache == null) {            _cache = ivy.getDefaultCache();        }        _artifactspattern = getProperty(_artifactspattern, ivy, "ivy.publish.src.artifacts.pattern");        if (_srcivypattern == null) {            _srcivypattern = _artifactspattern;        }        _status = getProperty(_status, ivy, "ivy.status");        if (_organisation == null) {            throw new BuildException("no organisation provided for ivy publish task: It can either be set explicitely via the attribute 'organisation' or via 'ivy.organisation' property or a prior call to <resolve/>");        }        if (_module == null) {            throw new BuildException("no module name provided for ivy publish task: It can either be set explicitely via the attribute 'module' or via 'ivy.module' property or a prior call to <resolve/>");        }        if (_revision == null) {            throw new BuildException("no module revision provided for ivy publish task: It can either be set explicitely via the attribute 'revision' or via 'ivy.revision' property or a prior call to <resolve/>");        }        if (_artifactspattern == null) {            throw new BuildException("no artifacts pattern: either provide it through parameter or through ivy.publish.src.artifacts.pattern property");        }        if (_publishResolverName == null) {            throw new BuildException("no publish deliver name: please provide it through parameter 'resolver'");        }        Date pubdate = getPubDate(_pubdate, new Date());        if (_pubRevision == null) {            if (_revision.startsWith("working@")) {                _pubRevision = Ivy.DATE_FORMAT.format(pubdate);            } else {                _pubRevision = _revision;            }        }        if (_status == null) {            throw new BuildException("no status provided: either provide it as parameter or through the ivy.status.default property");        }        ModuleRevisionId mrid = ModuleRevisionId.newInstance(_organisation, _module, _revision);        try {            File ivyFile = new File(_cache, IvyPatternHelper.substitute(_srcivypattern, _organisation, _module, _pubRevision, "ivy", "ivy", "xml"));            if (_publishivy && !ivyFile.exists()) {                IvyDeliver deliver = new IvyDeliver();                deliver.setProject(getProject());                deliver.setCache(getCache());                deliver.setDeliverpattern(getSrcivypattern());                deliver.setDelivertarget(_deliverTarget);                deliver.setDeliveryList(_deliveryList);                deliver.setModule(getModule());                deliver.setOrganisation(getOrganisation());                deliver.setPubdate(Ivy.DATE_FORMAT.format(pubdate));                deliver.setPubrevision(getPubrevision());                deliver.setRevision(getRevision());                deliver.setStatus(getStatus());                deliver.setValidate(doValidate(ivy));                                deliver.execute();            }                        Collection missing = ivy.publish(mrid, _pubRevision, _cache, _artifactspattern, _publishResolverName, _publishivy?_srcivypattern:null, doValidate(ivy), _overwrite);            if (_warnonmissing) {                for (Iterator iter = missing.iterator(); iter.hasNext();) {                    Artifact artifact = (Artifact)iter.next();                    Message.warn("missing artifact: "+artifact);                }            }            if (_haltonmissing && !missing.isEmpty()) {                throw new BuildException("missing published artifacts for "+mrid+": "+missing);            }                    } catch (Exception e) {            e.printStackTrace();            throw new BuildException("impossible to publish artifacts for "+mrid+": "+e.getMessage(), e);        }    }