From 4ebc515b84f6247278e74b6bea30048b146c769f Mon Sep 17 00:00:00 2001 From: Xavier Hanin Date: Tue, 25 Oct 2005 17:39:43 +0000 Subject: [PATCH] NEW: ability to output a path of dependencies in cache from the standalone mode (IVY-92) git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/trunk@484059 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + src/java/fr/jayasoft/ivy/Main.java | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f6a40e5c..0a1e9649 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,4 @@ +- NEW: ability to output a path of dependencies in cache from the standalone mode (IVY-92) - NEW: it is now possible to reference existing resolver in resolver containers (IVY-35) - NEW: overwrite attribute in the publish task now let force overwrite of read only files (IVY-83) - IMPROVE: ability to use no revision in pattern with latest.integration dependency, artifacts being updated according to revision change in ivy file (if checkmodified is set to true) (IVY-95) diff --git a/src/java/fr/jayasoft/ivy/Main.java b/src/java/fr/jayasoft/ivy/Main.java index 407c3e6e..cb7efd6e 100644 --- a/src/java/fr/jayasoft/ivy/Main.java +++ b/src/java/fr/jayasoft/ivy/Main.java @@ -6,6 +6,8 @@ package fr.jayasoft.ivy; import java.io.File; +import java.io.FileOutputStream; +import java.io.PrintWriter; import java.util.Arrays; import java.util.Collection; import java.util.Date; @@ -67,8 +69,9 @@ public class Main { .hasArg() .withDescription( "use given pattern as retrieve pattern" ) .create( "retrieve" ); - Option cachepath = OptionBuilder - .withDescription( "outputs a classpath consisting of all dependencies in cache (including transitive ones) of the given ivy file" ) + Option cachepath = OptionBuilder.withArgName( "cachepathfile" ) + .hasArg() + .withDescription( "outputs a classpath consisting of all dependencies in cache (including transitive ones) of the given ivy file to the given cachepathfile" ) .create( "cachepath" ); Option revision = OptionBuilder.withArgName( "revision" ) .hasArg() @@ -222,7 +225,7 @@ public class Main { ivy.retrieve(md.getModuleRevisionId().getModuleId(), confs, cache, retrievePattern); } if (line.hasOption("cachepath")) { - outputCachePath(ivy, cache, md, confs); + outputCachePath(ivy, cache, md, confs, line.getOptionValue("cachepath", "ivycachepath.txt")); } if (line.hasOption("revision")) { @@ -255,7 +258,7 @@ public class Main { } } - private static void outputCachePath(Ivy ivy, File cache, ModuleDescriptor md, String[] confs) { + private static void outputCachePath(Ivy ivy, File cache, ModuleDescriptor md, String[] confs, String outFile) { try { String pathSeparator = System.getProperty("path.separator"); StringBuffer buf = new StringBuffer(); @@ -272,7 +275,10 @@ public class Main { buf.append(pathSeparator); } } - System.out.println(buf.toString()); + PrintWriter writer = new PrintWriter(new FileOutputStream(outFile)); + writer.println(buf.toString()); + writer.close(); + System.out.println("cachepath output to "+outFile); } catch (Exception ex) { throw new RuntimeException("impossible to build ivy cache path: "+ex.getMessage(), ex); }