Using standalone


In the case you want to call ivy as a standalone program (outside from ant), you have to put commons-cli 1.0 and its dependencies in your classpath.

Then here is how to call it:
java org.apache.ivy.Main -?
It will indicate you what can be given as argument.


since 1.3 System properties are included as ivy variables, so you can easily define an ivy variable like this:
java -Dmyivyvar=myvalue org.apache.ivy.Main [parameters]

Examples

java org.apache.ivy.Main
calls ivy with default configuration using ivy.xml in the current dir

java org.apache.ivy.Main -conf path/to/myivysettings.xml -ivy path/to/myivy.xml
calls ivy with given ivysettings file using given ivy file

since 1.3
java org.apache.ivy.Main -conf path/to/myivysettings.xml -dependency apache commons-lang 2.0
calls ivy with given ivysettings file and resolve apache commons-lang 2.0.

This is equivalent to:
java org.apache.ivy.Main -conf path/to/myivysettings.xml -ivy ivy.xml
with ivy.xml like this:
<ivy-module version="1.0">
<info organisation="org"
module="standalone"
revision="working"
/>
<dependencies>
<dependency org="apache" name="commons-lang" rev="2.0" conf="default->*"/>
</dependencies>
</ivy-module>

since 1.3
java org.apache.ivy.Main -conf path/to/myivysettings.xml -ivy path/to/myivy.xml -cachepath mycachefile.txt
calls ivy with given ivysettings file and resolve the dependencies found in the given ivy file, and then output the classpath of resolved artifacts in cache in a file. This file can then be used to define a classpath corresponding to all the resolved dependencies for any java program.


since 1.4
java org.apache.ivy.Main -conf path/to/myivysettings.xml -dependency bar foo 2.0 -main org.bar.foo.FooMain
calls ivy with given ivysettings file and resolve bar foo 2.0, and then run org.foo.FooMain class with the resolved artifacts as classpath