public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache, String srcArtifactPattern, String resolverName, String srcIvyPattern, boolean validate, boolean overwrite) throws IOException { Message.info(":: publishing :: "+mrid); Message.verbose("\tvalidate = "+validate); long start = System.currentTimeMillis(); srcArtifactPattern = substitute(srcArtifactPattern); srcIvyPattern = substitute(srcIvyPattern);  File ivyFile = getResolvedIvyFileInCache(cache, mrid); if (!ivyFile.exists()) { throw new IllegalStateException("ivy file not found in cache for "+mrid+": please resolve dependencies before publishing ("+ivyFile+")"); } DependencyResolver resolver = getResolver(resolverName); if (resolver == null) { throw new IllegalArgumentException("unknown resolver "+resolverName); } ModuleDescriptor md = null; URL ivyFileURL = null; try { ivyFileURL = ivyFile.toURL(); md = XmlModuleDescriptorParser.getInstance().parseDescriptor(this, ivyFileURL, false); md.setResolvedModuleRevisionId(new ModuleRevisionId(mrid.getModuleId(), pubrevision)); } catch (MalformedURLException e) { throw new RuntimeException("malformed url obtained for file "+ivyFile); } catch (ParseException e) { throw new IllegalStateException("bad ivy file in cache for "+mrid+": please clean cache and resolve again"); }   Collection missing = publish(md, resolver, srcArtifactPattern, srcIvyPattern, overwrite); Message.verbose("\tpublish done ("+(System.currentTimeMillis()-start)+"ms)"); return missing;
public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache, String srcArtifactPattern, String resolverName, String srcIvyPattern, boolean validate) throws IOException { return publish(mrid, pubrevision, cache, srcArtifactPattern, resolverName, srcIvyPattern, validate, false);
    public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache, String srcArtifactPattern, String resolverName, String srcIvyPattern, boolean validate, boolean overwrite) throws IOException {        Message.info(":: publishing :: "+mrid);        Message.verbose("\tvalidate = "+validate);        long start = System.currentTimeMillis();        srcArtifactPattern = substitute(srcArtifactPattern);        srcIvyPattern = substitute(srcIvyPattern);        // 1) find the resolved module descriptor in cache        File ivyFile = getResolvedIvyFileInCache(cache, mrid);        if (!ivyFile.exists()) {            throw new IllegalStateException("ivy file not found in cache for "+mrid+": please resolve dependencies before publishing ("+ivyFile+")");        }        DependencyResolver resolver = getResolver(resolverName);        if (resolver == null) {            throw new IllegalArgumentException("unknown resolver "+resolverName);        }        ModuleDescriptor md = null;        URL ivyFileURL = null;        try {            ivyFileURL = ivyFile.toURL();            md = XmlModuleDescriptorParser.getInstance().parseDescriptor(this, ivyFileURL, false);            md.setResolvedModuleRevisionId(new ModuleRevisionId(mrid.getModuleId(), pubrevision));        } catch (MalformedURLException e) {            throw new RuntimeException("malformed url obtained for file "+ivyFile);        } catch (ParseException e) {            throw new IllegalStateException("bad ivy file in cache for "+mrid+": please clean cache and resolve again");        }                // collect all declared artifacts of this module        Collection missing = publish(md, resolver, srcArtifactPattern, srcIvyPattern, overwrite);        Message.verbose("\tpublish done ("+(System.currentTimeMillis()-start)+"ms)");        return missing;    }