How to programmatically build a path for a module in the cache using ivy api?

106 views Asked by At

I would like to perform a build path from the cache as described in the ivy official documentation programmatically (ie not using ant or the command line tool).

enter image description here

Unfortunately, there is no pointer to the corresponding classes in the ivy API that could help achieve that.

Is there any code sample that I could learn from?

1

There are 1 answers

0
Name is carl On BEST ANSWER

A starting point would be the read from the Main.java from ivy itself and look how cachepath operation is performed in Ivy's code.

Too see a sample of the output, run

java -jar ivy-2.4.0.jar -dependency commons-logging commons-logging 1.1 -cachepath file.txt

The file file.txt holds:

/home/cran/.ivy2/cache/commons-logging/commons-logging/sources/commons-logging-1.1-sources.jar:/home/cran/.ivy2/cache/commons-logging/commons-logging/j
ars/commons-logging-1.1.jar:/home/cran/.ivy2/cache/log4j/log4j/jars/log4j-1.2.12.jar:/home/cran/.ivy2/cache/logkit/logkit/jars/logkit-1.0.1.jar:/home/c
ran/.ivy2/cache/avalon-framework/avalon-framework/jars/avalon-framework-4.1.3.jar:/home/cran/.ivy2/cache/javax.servlet/servlet-api/jars/servlet-api-2.3
.jar