Index: src/main/groovy/grape/Grape.java =================================================================== --- src/main/groovy/grape/Grape.java (revision 18312) +++ src/main/groovy/grape/Grape.java (working copy) @@ -163,6 +163,10 @@ } public static URI[] resolve(Map args, Map... dependencies) { + return resolve(args, null, dependencies); + } + + public static URI[] resolve(Map args, List infoResolvedDeps, Map... dependencies) { URI[] uris = null; if (enableGrapes) { GrapeEngine instance = getInstance(); @@ -170,7 +174,7 @@ if (!args.containsKey("autoDownload")) { args.put("autoDownload" , Boolean.valueOf(enableAutoDownload)); } - uris = instance.resolve(args, dependencies); + uris = instance.resolve(args, infoResolvedDeps, dependencies); } } if (uris == null) { Index: src/main/groovy/grape/GrapeEngine.java =================================================================== --- src/main/groovy/grape/GrapeEngine.java (revision 18312) +++ src/main/groovy/grape/GrapeEngine.java (working copy) @@ -36,6 +36,8 @@ URI[] resolve(Map args, Map... dependencies); + URI[] resolve(Map args, List infoResolvedDeps, Map... dependencies); + Map[] listDependencies(ClassLoader classLoader); } Index: src/main/groovy/grape/GrapeIvy.groovy =================================================================== --- src/main/groovy/grape/GrapeIvy.groovy (revision 18312) +++ src/main/groovy/grape/GrapeIvy.groovy (working copy) @@ -301,6 +301,10 @@ } public URI [] resolve(Map args, Map... dependencies) { + resolve(args, null, dependencies) + } + + public URI [] resolve(Map args, List infoResolvedDeps, Map... dependencies) { // identify the target classloader early, so we fail before checking repositories def loader = chooseClassLoader( classLoader:args.remove('classLoader'), @@ -312,10 +316,14 @@ // If we were in fail mode we would have already thrown an exception if (!loader) return - resolve(loader, args, dependencies) + resolve(loader, args, infoResolvedDeps, dependencies) } URI [] resolve(ClassLoader loader, Map args, Map... dependencies) { + return resolve(loader, args, null, dependencies); + } + + URI [] resolve(ClassLoader loader, Map args, List infoResolvedDeps, Map... dependencies) { // check for mutually exclusive arguments Set keys = args.keySet() keys.each {a -> @@ -328,6 +336,8 @@ // check the kill switch if (!enableGrapes) { return } + boolean populateDepsInfo = (infoResolvedDeps != null); + Set localDeps = loadedDeps.get(loader) if (localDeps == null) { // use a linked set to preserve initial insertion order @@ -356,9 +366,18 @@ results += adl.localFile.toURI() } } + + if(populateDepsInfo) { + def deps = report.getDependencies() + deps.each { depNode -> + def id = depNode.getId() + infoResolvedDeps << ['group' : id.organisation, 'module' : id.name, 'revision' : id.revision] + } + } + return results as URI[] } - + public Map[] listDependencies (ClassLoader classLoader) { if (loadedDeps.containsKey(classLoader)) { List results = [] Index: src/main/org/codehaus/groovy/tools/GrapeMain.groovy =================================================================== --- src/main/org/codehaus/groovy/tools/GrapeMain.groovy (revision 18312) +++ src/main/org/codehaus/groovy/tools/GrapeMain.groovy (working copy) @@ -87,6 +87,11 @@ .withLongOpt("shell") .create('s') ); + options.addOption( + OptionBuilder.hasArg(false) + .withLongOpt("ivy") + .create('i') + ); CommandLine cmd2 = new PosixParser().parse(options, arg[1..-1] as String[], true); arg = cmd2.args @@ -103,6 +108,7 @@ return } def before, between, after + def ivyFormatRequested = false if (cmd2.hasOption('a')) { before = '\n + results += ('org="' + dep.group + '" name="' + dep.module + '" revision="' + dep.revision) + } } if (results) {