if (confs.length == 1 && "*".equals(confs[0])) { confs = md.getConfigurationsNames(); }
    public static void main(String[] args) throws Exception {        Options options = getOptions();                CommandLineParser parser = new GnuParser();        try {            // parse the command line arguments            CommandLine line = parser.parse( options, args );                        if (line.hasOption("?")) {                usage(options);                return;            }                        if (line.hasOption("debug")) {                Message.init(new DefaultMessageImpl(Message.MSG_DEBUG));            } else if (line.hasOption("verbose")) {                Message.init(new DefaultMessageImpl(Message.MSG_VERBOSE));            } else if (line.hasOption("warn")) {                Message.init(new DefaultMessageImpl(Message.MSG_WARN));            } else if (line.hasOption("error")) {                Message.init(new DefaultMessageImpl(Message.MSG_ERR));            } else {                Message.init(new DefaultMessageImpl(Message.MSG_INFO));            }                        boolean validate = line.hasOption("novalidate")?false:true;                        Ivy ivy = new Ivy();            String confPath = line.getOptionValue("conf", "");            if ("".equals(confPath)) {                ivy.configure(Ivy.class.getResource("ivyconf.xml"));            } else {                File conffile = new File(confPath);                if (!conffile.exists()) {                    error(options, "ivy configuration file not found: "+conffile);                } else if (conffile.isDirectory()) {                    error(options, "ivy configuration file is not a file: "+conffile);                }                ivy.configure(conffile);            }                        File cache = new File(ivy.substitute(line.getOptionValue("cache", "cache")));            if (!cache.exists()) {                cache.mkdirs();            } else if (!cache.isDirectory()) {                error(options, cache+" is not a directory");            }            File ivyfile = new File(ivy.substitute(line.getOptionValue("ivy", "ivy.xml")));            if (!ivyfile.exists()) {                error(options, "ivy file not found: "+ivyfile);            } else if (ivyfile.isDirectory()) {                error(options, "ivy file is not a file: "+ivyfile);            }            String[] confs;            if (line.hasOption("confs")) {                confs = line.getOptionValues("confs");            } else {                confs = new String[] {"*"};            }            Date date = new Date();                        ModuleDescriptor md = ivy.resolve(                    ivyfile.toURL(),                    null,                    confs,                     cache,                     date,                    validate).getModuleDescriptor();            if (line.hasOption("retrieve")) {                String retrievePattern = ivy.substitute(line.getOptionValue("retrieve"));                if (retrievePattern.indexOf("[") == -1) {                    retrievePattern = retrievePattern + "/lib/[conf]/[artifact].[type]";                }                ivy.retrieve(md.getModuleRevisionId().getModuleId(), confs, cache, retrievePattern);            }            if (line.hasOption("revision")) {                ivy.deliver(                    md.getResolvedModuleRevisionId(),                    ivy.substitute(line.getOptionValue("revision")),                    cache,                     ivy.substitute(line.getOptionValue("publish", "ivy-[revision].xml")),                    ivy.substitute(line.getOptionValue("status", "release")),                    date,                    new DefaultPublishingDRResolver(),                    validate);            }        } catch( ParseException exp ) {            // oops, something went wrong            System.err.println( "Parsing failed.  Reason: " + exp.getMessage() );                        usage(options);        }            }