Apache Lucene open-source search software
LUCENE-3892: configure fallbacks so that ivy downloads work from china
Robert Muirf8577e6cb4f2
diff --git a/lucene/common-build.xml b/lucene/common-build.xmlindex 47e7e07e36f..b9257fb454e 100644--- a/lucene/common-build.xml+++ b/lucene/common-build.xml@@ -267,12 +267,22 @@<!-- currently empty --></target>- <target name="resolve" depends="ivy-availability-check,ivy-fail">+ <target name="ivy-configure">+ <ivy:configure file="${common.dir}/ivy-settings.xml"/>+ </target>++ <target name="resolve" depends="ivy-availability-check,ivy-fail,ivy-configure"><!-- todo, make this a property or something.only special cases need bundles --><ivy:retrieve type="jar,bundle" log="download-only"/></target>+ <property name="ivy_install_path" location="${user.home}/.ant/lib" />+ <property name="ivy_bootstrap_url1" value="http://repo1.maven.org/maven2"/>+ <!-- you might need to tweak this from china so it works -->+ <property name="ivy_bootstrap_url2" value="http://mirror.netcologne.de/maven2"/>+ <property name="ivy_checksum_sha1" value="f9d1e83e82fc085093510f7d2e77d81d52bc2081"/>+<target name="ivy-availability-check" unless="ivy.available"><echo>This build requires Ivy and Ivy could not be found in your ant classpath.@@ -311,13 +321,40 @@<target name="ivy-fail" unless="ivy.available"><fail>Ivy is not available</fail></target>- <target name="ivy-bootstrap" description="Download and install Ivy in the users ant lib dir">- <property name="ivy_install_path" location="${user.home}/.ant/lib" />- <mkdir dir="${ivy_install_path}"/>- <echo message="installing ivy ${ivy.bootstrap.version} to ${ivy_install_path}"/>- <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.bootstrap.version}/ivy-${ivy.bootstrap.version}.jar"- dest="${ivy_install_path}/ivy-${ivy.bootstrap.version}.jar" usetimestamp="true"/>+ <target name="ivy-bootstrap" description="Download and install Ivy in the users ant lib dir" depends="ivy-bootstrap1,ivy-bootstrap2,ivy-checksum"/>++ <!-- try to download from repo1.maven.org -->+ <target name="ivy-bootstrap1">+ <ivy-download src="${ivy_bootstrap_url1}" dest="${ivy_install_path}"/>+ <available file="${ivy_install_path}/ivy-${ivy.bootstrap.version}.jar" property="ivy.bootstrap1.success" />+ </target>++ <target name="ivy-bootstrap2" unless="ivy.bootstrap1.success">+ <ivy-download src="${ivy_bootstrap_url2}" dest="${ivy_install_path}"/>+ </target>++ <target name="ivy-checksum">+ <checksum file="${ivy_install_path}/ivy-${ivy.bootstrap.version}.jar"+ property="${ivy_checksum_sha1}"+ algorithm="SHA"+ verifyproperty="ivy.checksum.success"/>+ <fail message="Checksum mismatch for ivy-${ivy.bootstrap.version}.jar. Please download this file manually">+ <condition>+ <isfalse value="${ivy.checksum.success}"/>+ </condition>+ </fail></target>++ <macrodef name="ivy-download">+ <attribute name="src"/>+ <attribute name="dest"/>+ <sequential>+ <mkdir dir="@{dest}"/>+ <echo message="installing ivy ${ivy.bootstrap.version} to ${ivy_install_path}"/>+ <get src="@{src}/org/apache/ivy/ivy/${ivy.bootstrap.version}/ivy-${ivy.bootstrap.version}.jar"+ dest="@{dest}/ivy-${ivy.bootstrap.version}.jar" usetimestamp="true" ignoreerrors="true"/>+ </sequential>+ </macrodef><target name="jflex-uptodate-check"><uptodate property="jflex.files.uptodate">@@ -1057,7 +1094,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites<fail message="You must redefine the javadocs task to do something!!!!!"/></target>- <target name="install-maven-tasks" unless="maven-tasks.uptodate" depends="ivy-availability-check,ivy-fail">+ <target name="install-maven-tasks" unless="maven-tasks.uptodate" depends="ivy-availability-check,ivy-fail,ivy-configure"><property name="maven-tasks.uptodate" value="true"/><ivy:cachepath organisation="org.apache.maven" module="maven-ant-tasks" revision="2.1.3"inline="true" conf="master" type="jar" pathid="maven-ant-tasks.classpath"/>@@ -1509,7 +1546,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites<!-- PEGDOWN macro: Before using depend on the target "resolve-pegdown" -->- <target name="resolve-pegdown" unless="pegdown.loaded">+ <target name="resolve-pegdown" unless="pegdown.loaded" depends="ivy-availability-check,ivy-fail,ivy-configure"><ivy:cachepath organisation="org.pegdown" module="pegdown" revision="1.1.0"inline="true" conf="default" type="jar" transitive="true" pathid="pegdown.classpath"/><property name="pegdown.loaded" value="true"/>diff --git a/lucene/ivy-settings.xml b/lucene/ivy-settings.xmlnew file mode 100644index 00000000000..8c822860b07--- /dev/null+++ b/lucene/ivy-settings.xml@@ -0,0 +1,40 @@+<!--+ Licensed to the Apache Software Foundation (ASF) under one+ or more contributor license agreements. See the NOTICE file+ distributed with this work for additional information+ regarding copyright ownership. The ASF licenses this file+ to you under the Apache License, Version 2.0 (the+ "License"); you may not use this file except in compliance+ with the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing,+ software distributed under the License is distributed on an+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ KIND, either express or implied. See the License for the+ specific language governing permissions and limitations+ under the License.+-->+<ivysettings>+ <settings defaultResolver="default"/>++ <include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>+ <include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>+ <include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>+ <include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>++ <resolvers>+ <ibiblio name="sonatype-releases" root="http://oss.sonatype.org/content/repositories/releases" m2compatible="true" />+ <!-- you might need to tweak this from china so it works -->+ <ibiblio name="working-chinese-mirror" root="http://mirror.netcologne.de/maven2" m2compatible="true" />++ <chain name="default" returnFirst="true" checkmodified="true">+ <resolver ref="local"/>+ <resolver ref="main"/>+ <resolver ref="sonatype-releases" />+ <resolver ref="working-chinese-mirror" />+ </chain>+ </resolvers>++</ivysettings>diff --git a/lucene/misc/build.xml b/lucene/misc/build.xmlindex 45931df8381..3c5e19f64df 100644--- a/lucene/misc/build.xml+++ b/lucene/misc/build.xml@@ -27,7 +27,7 @@<import file="../module-build.xml"/>- <target name="install-cpptasks" unless="cpptasks.uptodate" depends="ivy-availability-check,ivy-fail">+ <target name="install-cpptasks" unless="cpptasks.uptodate" depends="ivy-availability-check,ivy-fail,ivy-configure"><property name="cpptasks.uptodate" value="true"/><ivy:cachepath organisation="ant-contrib" module="cpptasks" revision="1.0b5"inline="true" conf="master" type="jar" pathid="cpptasks.classpath"/>diff --git a/lucene/test-framework/ivysettings.xml b/lucene/test-framework/ivysettings.xmldeleted file mode 100644index 50629eb7286..00000000000--- a/lucene/test-framework/ivysettings.xml+++ /dev/null@@ -1,19 +0,0 @@-<ivysettings>- <!-- Default Ivy settings. -->- <settings defaultResolver="default"/>-- <include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>- <include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>- <include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>- <include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>-- <resolvers>- <ibiblio name="sonatype-releases" root="http://oss.sonatype.org/content/repositories/releases" m2compatible="true" />-- <chain name="default" returnFirst="true" checkmodified="true">- <resolver ref="local"/>- <resolver ref="main"/>- <resolver ref="sonatype-releases" />- </chain>- </resolvers>-</ivysettings>\ No newline at end of filediff --git a/solr/example/build.xml b/solr/example/build.xmlindex 7cbcb94f97d..fdfbe95b829 100644--- a/solr/example/build.xml+++ b/solr/example/build.xml@@ -33,7 +33,7 @@<target name="compile-core"/><target name="compile-test"/>- <target name="resolve" depends="ivy-availability-check">+ <target name="resolve" depends="ivy-availability-check,ivy-fail,ivy-configure"><sequential><!-- jetty libs in lib/ --><ivy:retrieve conf="default" type="jar" log="download-only"/>