all.addAll(Arrays.asList(artifacts)); } for (Iterator iter = all.iterator(); iter.hasNext();) { Artifact artifact = (Artifact)iter.next(); String name = IvyPatternHelper.substitute(ivy.substitute(getName()), artifact); String value = IvyPatternHelper.substitute(ivy.substitute(getValue()), artifact); getProject().setProperty(name, value);
for (int j = 0; j < artifacts.length; j++) { Artifact artifact = artifacts[j]; String name = IvyPatternHelper.substitute(ivy.substitute(getName()), artifact, confs[i]); String value = IvyPatternHelper.substitute(ivy.substitute(getValue()), artifact, confs[i]); getProject().setProperty(name, value); }
    public void execute() throws BuildException {        Ivy ivy = getIvyInstance();                _organisation = getProperty(_organisation, ivy, "ivy.organisation");        _module = getProperty(_module, ivy, "ivy.module");        ensureResolved(isHaltonfailure(), getOrganisation(), getModule());                _conf = getProperty(_conf, ivy, "ivy.resolved.configurations");        if ("*".equals(_conf)) {            _conf = getProperty(ivy, "ivy.resolved.configurations");            if (_conf == null) {                throw new BuildException("bad provided for ivy artifactproperty: * can only be used with a prior call to <resolve/>");            }        }        _organisation = getProperty(_organisation, ivy, "ivy.organisation");        _module = getProperty(_module, ivy, "ivy.module");        if (_cache == null) {            _cache = ivy.getDefaultCache();        }                if (_organisation == null) {            throw new BuildException("no organisation provided for ivy artifactproperty: 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 artifactproperty: It can either be set explicitely via the attribute 'module' or via 'ivy.module' property or a prior call to <resolve/>");        }        if (_conf == null) {            throw new BuildException("no conf provided for ivy artifactproperty: It can either be set explicitely via the attribute 'conf' or via 'ivy.resolved.configurations' property or a prior call to <resolve/>");        }        try {            XmlReportParser parser = new XmlReportParser();            String[] confs = splitConfs(_conf);            Collection all = new HashSet();            for (int i = 0; i < confs.length; i++) {                Artifact[] artifacts = parser.getArtifacts(new ModuleId(_organisation, _module), confs[i], _cache);                all.addAll(Arrays.asList(artifacts));            }            for (Iterator iter = all.iterator(); iter.hasNext();) {                Artifact artifact = (Artifact)iter.next();                String name = IvyPatternHelper.substitute(ivy.substitute(getName()), artifact);                String value = IvyPatternHelper.substitute(ivy.substitute(getValue()), artifact);                getProject().setProperty(name, value);            }        } catch (Exception ex) {            throw new BuildException("impossible to add artifact properties: "+ex.getMessage(), ex);        }    }