Configure ivy home directory in Ant

I would like to set ivy.default.ivy.user.dir to a value other than the default value of ${user.home}/.ivy2 . I can do this on the command line with

ant -Divy.default.ivy.user.dir=${WORKSPACE}/IVYCACHE . But I would like it to be installed without the arg command line. I tried to set this property in my build.xml, my common.xml and my ivysettings.xml. It is strange that it sets the default cache for this path, but the detailed output indicates that there is no default value for user.dir, so it uses the path ${user.home}/.ivy2 .

Here is the result when I install user.dir in the build.xml file. Oddly enough, it sets the default cache to the path that I used for user.dir

  [ivy: buildlist] No ivy: settings found for the default reference 'ivy.instance'.  A default instance will be used
 [ivy: buildlist] Loading jar: file: /usr/local/ant/lib/ivy-2.2.0.jar! /org/apache/ivy/core/settings/ivy.properties
 [ivy: buildlist] searching settings file: trying /home/hudson/.hudson/jobs/Next_CI/workspace/ivysettings.xml
 [ivy: buildlist] searching settings file: trying /home/hudson/.hudson/jobs/Next_CI/workspace/ivyconf.xml
 [ivy: buildlist] searching settings file: trying ivysettings.xml
 [ivy: buildlist] searching settings file: trying ivyconf.xml
 [ivy: buildlist] no settings file found, using default ...
 [ivy: buildlist] :: Ivy 2.2.0 - 20100923230623 :: http://ant.apache.org/ivy/ ::
 [ivy: buildlist] jakarta commons httpclient not found: using jdk url handling
 [ivy: buildlist] :: loading settings :: url = jar: file: /usr/local/ant/lib/ivy-2.2.0.jar! /org/apache/ivy/core/settings/ivysettings.xml
 [ivy: buildlist] including url: jar: file: /usr/local/ant/lib/ivy-2.2.0.jar! /org/apache/ivy/core/settings/ivysettings-public.xml
 [ivy: buildlist] no default cache defined: set to /home/hudson/.hudson/jobs/Next_CI/workspace/ivy2/cache
 [ivy: buildlist] including url: jar: file: /usr/local/ant/lib/ivy-2.2.0.jar! /org/apache/ivy/core/settings/ivysettings-shared.xml
 [ivy: buildlist] including url: jar: file: /usr/local/ant/lib/ivy-2.2.0.jar! /org/apache/ivy/core/settings/ivysettings-local.xml
 [ivy: buildlist] including url: jar: file: /usr/local/ant/lib/ivy-2.2.0.jar! /org/apache/ivy/core/settings/ivysettings-main-chain.xml
 [ivy: buildlist] including url: jar: file: /usr/local/ant/lib/ivy-2.2.0.jar! /org/apache/ivy/core/settings/ivysettings-default-chain.xml
 [ivy: buildlist] settings loaded (71ms)
 [ivy: buildlist] default cache: /home/hudson/.hudson/jobs/Next_CI/workspace/ivy2/cache

He then claims that user.dir is not installed anywhere. I decide:

  [ivy: resolve] Loading jar: file: /usr/local/ant/lib/ivy-2.2.0.jar! /org/apache/ivy/core/settings/ivy.properties
 [ivy: resolve] jakarta commons httpclient not found: using jdk url handling
 [ivy: resolve] :: loading settings :: file = /home/hudson/.hudson/jobs/Next_CI/workspace/common/ivysettings.xml
 [ivy: resolve] no default ivy user dir defined: set to /home/hudson/.ivy2

Here is my build.xml line:

 <property name="ivy.default.ivy.user.dir" value="${basedir}/ivy2" /> 

I tried adding this line to regular /ivysettings.xml and common / common.xml with no luck.

+7
source share
2 answers

I added the exact line shown in the build.xml sample build.xml in the ivy binary download, and I could see artifacts loaded in the ivy2 subfolder in the samples folder.

 ... <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" /> <property name="ivy.default.ivy.user.dir" value="${basedir}/ivy2" /> ... 

I am using ivy 2.2 and ant 1.8.2. Can you check if the same thing works for you?

[Edit]: From docs ,

In fact, all ant properties are imported into ivy variables when the configuration is done (if you call ivy from ant). This means that if you define the ant property after a call to configure it will not be available as an ivy variable.

+5
source

The ANT_OPTS environment variable allows you to set jvm parameters. That way you can add the same command line argument to your ANT_OPTS that you call the 'ant' shell script with. For example. under m $ windoozer:

 ANT_OPTS=-Divy.default.ivy.user.dir=C:/IVYCACHE 
+3
source

All Articles