Implement ivy.home and ivy.cache

22 views
Skip to first unread message

Claudio Miranda

unread,
Aug 11, 2009, 2:20:23 PM8/11/09
to dev-ivybeans
I plan to store the ivy.home and ivy.cache.dir using the Java
Preferences API on the user directory.

What do you think about this ?

Claudio

Laurent Forêt

unread,
Aug 12, 2009, 4:11:14 AM8/12/09
to dev-iv...@googlegroups.com
It is the thing to do and linked with issue-47 and issue-50.


Laurent Forêt

Claudio Miranda

unread,
Aug 12, 2009, 11:30:08 AM8/12/09
to dev-ivybeans
I have that working for ivy.home.

For the default ivy cache dir, if the user doesn't provide a ivy-
settings.xml file or doesn't specify one, can we assume a $
{user.home}/.ivi2/cache ? I also have this working.
The Ivy documentation says that should be the default directory for
cache

defaultCacheDir
a path to a directory to use as default basedir for both resolution
and repository cache(s)
No, defaults to .ivy2/cache in the user's home directory


On Aug 12, 5:11 am, Laurent Forêt <laurent.fo...@gmail.com> wrote:
> It is the thing to do and linked with issue-47 and issue-50.
>
> Laurent Forêt
>

Claudio Miranda

unread,
Aug 13, 2009, 11:52:15 PM8/13/09
to dev-ivybeans
I have modified IvyLibrary class, as seen below

Basically if the default cache is the IvyJar file followed by "/
cache", it is replaced by ${user.home}/.ivy2/cache
default cache: /opt/lib/apache-ivy-2.1.0-rc2/ivy-2.1.0-rc2.jar/cache

private void configure() {
try {
ivy.configure(settingsURL);
IvySettings ivySettings = ivy.getSettings();
String ivyJarPath = System.getProperty("ivy.home");
if (ivySettings.getDefaultCache().equals(new File(ivyJarPath +
"/cache"))) {
File defaultCacheDir = new File(System.getProperty
("user.home") + "/.ivy2/cache");
ivySettings.setDefaultCache(defaultCacheDir);
}
} catch (ParseException e) {
throw new IvyLibraryParsingException(e.getMessage(),
settingsURL, e);
} catch (IOException e) {
throw new IvyLibraryIOException(e.getMessage(), settingsURL,
e);
}
}


The resolve and retrieve tasks work fine. But the javac compilation,
doesn't work

:: resolving dependencies :: nb1-ivy#nb1-ivy;1.0
confs: [compile, runtime, compile-test, runtime-test]
/home/claudio/tmp/nb1-ivy/nbproject/ivy-impl.xml:59: impossible to
resolve dependencies:
java.io.FileNotFoundException: /opt/lib/apache-ivy-2.1.0-rc2/
ivy-2.1.0-rc2.jar/cache/resolved-nb1-ivy-nb1-ivy-1.0.xml (Not a
directory)
BUILD FAILED (total time: 15 seconds)

The jar files at the cache

$ find ~/.ivy2/cache/ -type f -name \*.jar
/home/claudio/.ivy2/cache/org.apache.wicket/wicket/javadocs/
wicket-1.4.0-javadoc.jar
/home/claudio/.ivy2/cache/org.apache.wicket/wicket/sources/
wicket-1.4.0-sources.jar
/home/claudio/.ivy2/cache/org.apache.wicket/wicket/jars/
wicket-1.4.0.jar
/home/claudio/.ivy2/cache/junit/junit/javadocs/junit-4.4-javadoc.jar
/home/claudio/.ivy2/cache/junit/junit/sources/junit-4.4-sources.jar
/home/claudio/.ivy2/cache/junit/junit/jars/junit-4.4.jar
/home/claudio/.ivy2/cache/commons-cli/commons-cli/javadocs/commons-
cli-1.2-javadoc.jar
/home/claudio/.ivy2/cache/commons-cli/commons-cli/sources/commons-
cli-1.2-sources.jar
/home/claudio/.ivy2/cache/commons-cli/commons-cli/jars/commons-
cli-1.2.jar
/home/claudio/.ivy2/cache/org.slf4j/slf4j-api/sources/slf4j-api-1.4.2-
sources.jar
/home/claudio/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.4.2.jar
/home/claudio/.ivy2/cache/joda-time/joda-time/javadocs/joda-time-1.5.1-
javadoc.jar
/home/claudio/.ivy2/cache/joda-time/joda-time/sources/joda-time-1.5.1-
sources.jar
/home/claudio/.ivy2/cache/joda-time/joda-time/jars/joda-time-1.5.1.jar
/home/claudio/.ivy2/cache/asm/asm/jars/asm-1.5.3.jar
/home/claudio/.ivy2/cache/cglib/cglib/sources/cglib-2.1_3-sources.jar
/home/claudio/.ivy2/cache/cglib/cglib/jars/cglib-2.1_3.jar

Is there other place where the default cache dir can be configured ?

Thanks

Claudio Miranda

Laurent Forêt

unread,
Aug 14, 2009, 7:19:10 AM8/14/09
to dev-iv...@googlegroups.com
Yes surely in ivy-impl.xml.

Laurent.
Reply all
Reply to author
Forward
0 new messages