You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2012/03/30 00:01:31 UTC

svn commit: r1307135 - in /lucene/dev/branches/lucene3930: build.xml lucene/common-build.xml

Author: hossman
Date: Thu Mar 29 22:01:30 2012
New Revision: 1307135

URL: http://svn.apache.org/viewvc?rev=1307135&view=rev
Log:
LUCENE-3930: pretty error if ivy is not in classpath, and a new ivy-bootstrap target to help the user install it

Modified:
    lucene/dev/branches/lucene3930/build.xml
    lucene/dev/branches/lucene3930/lucene/common-build.xml

Modified: lucene/dev/branches/lucene3930/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3930/build.xml?rev=1307135&r1=1307134&r2=1307135&view=diff
==============================================================================
--- lucene/dev/branches/lucene3930/build.xml (original)
+++ lucene/dev/branches/lucene3930/build.xml Thu Mar 29 22:01:30 2012
@@ -128,4 +128,10 @@
     </sequential>
   </target>
 
+  <target name="ivy-bootstrap">
+    <subant target="ivy-bootstrap" inheritall="false" failonerror="true">
+      <fileset dir="lucene" includes="build.xml" />
+    </subant>
+  </target>
+
 </project>

Modified: lucene/dev/branches/lucene3930/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3930/lucene/common-build.xml?rev=1307135&r1=1307134&r2=1307135&view=diff
==============================================================================
--- lucene/dev/branches/lucene3930/lucene/common-build.xml (original)
+++ lucene/dev/branches/lucene3930/lucene/common-build.xml Thu Mar 29 22:01:30 2012
@@ -53,6 +53,10 @@
   <property name="year" value="2000-${current.year}"/>
   <property name="final.name" value="lucene-${name}-${version}"/>
 
+  <property name="ivy.bootstrap.version" value="2.2.0" />
+  <property name="ivy.resource" value="org/apache/ivy/ant/antlib.xml" />
+  <available resource="${ivy.resource}" property="ivy.available" />
+
   <property name="junit.jar" value="junit-4.10.jar"/>
   <property name="junit-location.jar" value="${common.dir}/test-framework/lib/${junit.jar}"/>
   <path id="junit-path">
@@ -248,9 +252,49 @@
     <!-- currently empty -->
   </target>
 
-  <target name="resolve">
+  <target name="resolve" depends="ivy-availability-check,ivy-fail">
     <ivy:retrieve type="jar,bundle" log="download-only"/>
   </target>
+  <target name="ivy-availability-check" unless="ivy.available">
+   <echo>
+     This build requires Ivy and Ivy could not be found in your ant classpath
+
+     (Due to classpath issues and the recursive nature of the Lucene/Solr 
+     build system, a local copy of Ivy can not be used an loaded dynamically 
+     by the build.xml)
+
+     You can either manually install a copy of Ivy ${ivy.bootstrap.version} in your ant classpath:
+       http://ant.apache.org/manual/install.html#optionalTasks
+
+     Or this build file can do it for you by running the Ivy Bootstrap target:
+       ant ivy-bootstrap     
+     
+     Either way you will only have to install Ivy one time.
+
+     'ant ivy-bootstrap' will install a copy of Ivy into your Ant User Library:
+       ${user.home}/.ant/lib
+     
+     If you would prefer, you can have it installed into an alternative 
+     directory using the "-Divy_install_path=/some/path/you/choose" option, 
+     but you will have to specify this path every time you build Lucene/Solr 
+     in the future...
+       ant ivy-bootstrap -Divy_install_path=/some/path/you/choose
+       ...
+       ant -lib /some/path/you/choose clean compile
+       ...
+       ant -lib /some/path/you/choose clean compile
+    </echo>
+  </target>
+  <target name="ivy-fail" unless="ivy.available">
+    <fail>Ivy is not available</fail>
+  </target>
+  <target name="ivy-bootstrap">
+    <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>
 
   <target name="jflex-uptodate-check">
     <uptodate property="jflex.files.uptodate">