Skip to content

Apache Lucene open-source search software

LUCENE-6277: Allow Ivy resolutionCacheDir to be overridden by system property.

Mark Robert Miller3728802dfdf2
diff --git a/lucene/build.xml b/lucene/build.xml
index 1a75b70d73d..357e68d5df5 100644
--- a/lucene/build.xml
+++ b/lucene/build.xml
@@ -97,6 +97,7 @@
<lib-versions-check-macro dir="${common.dir}/.."
centralized.versions.file="${common.dir}/ivy-versions.properties"
ivy.settings.file="${common.dir}/ivy-settings.xml"
+ ivy.resolution-cache.dir="${ivy.resolution-cache.dir}"
common.build.dir="${common.build.dir}"
ignore.conflicts.file="${common.dir}/ivy-ignore-conflicts.properties"/>
</target>
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index ecf1ca87c47..9d8dae3b552 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -75,9 +75,14 @@
<!-- we exclude ext/*.jar because we don't want example/lib/ext logging jars on the cp -->
<property name="common.classpath.excludes" value="**/*.txt,**/*.template,**/*.sha1,ext/*.jar" />
+ <property name="build.dir" location="build"/>
+ <!-- Needed in case a module needs the original build, also for compile-tools to be called from a module -->
+ <property name="common.build.dir" location="${common.dir}/build"/>
+
<property name="ivy.bootstrap.version" value="2.3.0" />
<property name="ivy.default.configuration" value="*"/>
<property name="ivy.sync" value="true"/>
+ <property name="ivy.resolution-cache.dir" location="${common.build.dir}/ivy-resolution-cache"/>
<property name="junit.jar" value="junit-4.10.jar"/>
<property name="junit-location.jar" location="${common.dir}/test-framework/lib/${junit.jar}"/>
@@ -229,9 +234,6 @@
<property name="resources.dir" location="${src.dir}/../resources"/>
<property name="tests.src.dir" location="src/test"/>
<available property="module.has.tests" type="dir" file="${tests.src.dir}"/>
- <property name="build.dir" location="build"/>
- <!-- Needed in case a module needs the original build, also for compile-tools to be called from a module -->
- <property name="common.build.dir" location="${common.dir}/build"/>
<property name="dist.dir" location="${common.dir}/dist"/>
<property name="maven.dist.dir" location="${dist.dir}/maven"/>
<makeurl file="${maven.dist.dir}" property="m2.repository.url" validate="false"/>
diff --git a/lucene/ivy-settings.xml b/lucene/ivy-settings.xml
index 6e364492f96..770b07c72c0 100644
--- a/lucene/ivy-settings.xml
+++ b/lucene/ivy-settings.xml
@@ -28,7 +28,7 @@
<include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>
- <caches lockStrategy="artifact-lock" resolutionCacheDir="${common.build.dir}/ivy-resolution-cache" />
+ <caches lockStrategy="artifact-lock" resolutionCacheDir="${ivy.resolution-cache.dir}" />
<resolvers>
<ibiblio name="sonatype-releases" root="https://oss.sonatype.org/content/repositories/releases" m2compatible="true" />
diff --git a/lucene/tools/custom-tasks.xml b/lucene/tools/custom-tasks.xml
index 53c4c93d08e..53fb7a2485f 100644
--- a/lucene/tools/custom-tasks.xml
+++ b/lucene/tools/custom-tasks.xml
@@ -89,6 +89,7 @@
<attribute name="dir"/>
<attribute name="centralized.versions.file"/>
<attribute name="ivy.settings.file"/>
+ <attribute name="ivy.resolution-cache.dir"/>
<attribute name="common.build.dir"/>
<attribute name="ignore.conflicts.file"/>
<sequential>
@@ -100,6 +101,7 @@
<echo>Lib versions check under: @{dir}</echo>
<libversions centralizedVersionsFile="@{centralized.versions.file}"
ivySettingsFile="@{ivy.settings.file}"
+ ivyResolutionCacheDir="@{ivy.resolution-cache.dir}"
commonBuildDir="@{common.build.dir}"
ignoreConflictsFile="@{ignore.conflicts.file}">
<fileset dir="@{dir}">
diff --git a/lucene/tools/src/java/org/apache/lucene/validation/LibVersionsCheckTask.java b/lucene/tools/src/java/org/apache/lucene/validation/LibVersionsCheckTask.java
index e9abc5574a8..2f42629d7db 100644
--- a/lucene/tools/src/java/org/apache/lucene/validation/LibVersionsCheckTask.java
+++ b/lucene/tools/src/java/org/apache/lucene/validation/LibVersionsCheckTask.java
@@ -121,6 +121,11 @@ public class LibVersionsCheckTask extends Task {
*/
private File commonBuildDir;
+ /**
+ * Location of ivy cache resolution directory.
+ */
+ private File ivyResolutionCacheDir;
+
/**
* A logging level associated with verbose logging.
*/
@@ -174,6 +179,10 @@ public class LibVersionsCheckTask extends Task {
public void setIvySettingsFile(File file) {
ivySettingsFile = file;
}
+
+ public void setIvyResolutionCacheDir(File dir) {
+ ivyResolutionCacheDir = dir;
+ }
public void setCommonBuildDir(File file) {
commonBuildDir = file;
@@ -673,6 +682,7 @@ public class LibVersionsCheckTask extends Task {
try {
ivySettings.setVariable("common.build.dir", commonBuildDir.getAbsolutePath());
ivySettings.setVariable("ivy.exclude.types", "source|javadoc");
+ ivySettings.setVariable("ivy.resolution-cache.dir", ivyResolutionCacheDir.getAbsolutePath());
ivySettings.setBaseDir(commonBuildDir);
ivySettings.setDefaultConflictManager(new NoConflictManager());
ivy = Ivy.newInstance(ivySettings);