Index: lucene/analysis/common/build.xml
===================================================================
--- lucene/analysis/common/build.xml	(revision 1560258)
+++ lucene/analysis/common/build.xml	(working copy)
@@ -29,7 +29,7 @@
 
   <import file="../analysis-module-build.xml"/>
 	
-  <target name="jflex" depends="jflex-check,clean-jflex,-gen-uax29-supp-macros,
+  <target name="jflex" depends="-install-jflex,clean-jflex,-gen-uax29-supp-macros,
                                 -jflex-StandardAnalyzer,-jflex-UAX29URLEmailTokenizer,
                                 -jflex-wiki-tokenizer,-jflex-HTMLStripCharFilter"/>
 
@@ -40,11 +40,7 @@
   </target>
 
   <target name="-jflex-HTMLStripCharFilter"
-          depends="init,jflex-check,generate-jflex-html-char-entities"
-          if="jflex.present">
-    <taskdef classname="jflex.anttask.JFlexTask" name="jflex">
-      <classpath refid="jflex.classpath"/>
-    </taskdef>
+          depends="init,generate-jflex-html-char-entities">
     <jflex file="src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.jflex"
            outdir="src/java/org/apache/lucene/analysis/charfilter"
            nobak="on" inputstreamctor="false"/>
@@ -65,25 +61,16 @@
     <fixcrlf file="src/java/org/apache/lucene/analysis/charfilter/HTMLCharacterEntities.jflex" encoding="UTF-8"/>
   </target>
 
-  <target name="-jflex-wiki-tokenizer" depends="init,jflex-check" if="jflex.present">
-    <taskdef classname="jflex.anttask.JFlexTask" name="jflex">
-      <classpath refid="jflex.classpath"/>
-    </taskdef>
+  <target name="-jflex-wiki-tokenizer" depends="init,-install-jflex">
     <run-jflex dir="src/java/org/apache/lucene/analysis/wikipedia" name="WikipediaTokenizerImpl"/>
   </target>
 
-  <target name="-jflex-StandardAnalyzer" depends="init,jflex-check" if="jflex.present">
-    <taskdef classname="jflex.anttask.JFlexTask" name="jflex">
-			<classpath refid="jflex.classpath"/>
-    </taskdef>
+  <target name="-jflex-StandardAnalyzer" depends="init,-install-jflex">
     <run-jflex dir="src/java/org/apache/lucene/analysis/standard" name="StandardTokenizerImpl"/>
     <run-jflex dir="src/java/org/apache/lucene/analysis/standard" name="ClassicTokenizerImpl"/>
   </target>
 
-  <target name="-jflex-UAX29URLEmailTokenizer" depends="jflex-check" if="jflex.present">
-    <taskdef classname="jflex.anttask.JFlexTask" name="jflex">
-			<classpath refid="jflex.classpath"/>
-    </taskdef>
+  <target name="-jflex-UAX29URLEmailTokenizer" depends="init,-install-jflex">
     <run-jflex dir="src/java/org/apache/lucene/analysis/standard" name="UAX29URLEmailTokenizerImpl"/>
   </target>
   
Index: lucene/common-build.xml
===================================================================
--- lucene/common-build.xml	(revision 1560258)
+++ lucene/common-build.xml	(working copy)
@@ -227,17 +227,6 @@
   <property name="m2.repository.id" value="local"/>
   <property name="m2.credentials.prompt" value="true"/>
 
-  <property name="jflex.home" location="${common.dir}"/>
-
-  <path id="jflex.classpath">
-    <fileset dir="${jflex.home}/">
-      <!-- for a JFlex trunk checkout: -->
-      <include name="jflex/target/*.jar"/>
-      <!-- for a JFlex distribution (not yet available): -->
-      <include name="lib/*.jar"/>
-    </fileset>
-  </path>
-
   <property name="backwards.dir" location="backwards"/>
   <property name="build.dir.backwards" location="${build.dir}/backwards"/>
 
@@ -472,31 +461,6 @@
     </sequential>
   </macrodef>
 
-  <target name="jflex-check">
-    <available property="jflex.present" classname="jflex.anttask.JFlexTask">
-      <classpath refid="jflex.classpath"/>
-    </available>
-    <fail unless="jflex.present">&#xA0;
-      ##################################################################
-      JFlex not found.
-      JFlex Home: ${jflex.home}
-
-      Please install the jFlex 1.5 version (currently not released)
-      from its SVN repository:
-
-       svn co -r 722 https://svn.code.sf.net/p/jflex/code/trunk jflex
-       cd jflex
-       mvn install
-
-      Then, create a build.properties file either in your home
-      directory, or within the Lucene directory and set the jflex.home
-      property to the path where the JFlex trunk checkout is located
-      (in the above example it's the directory called "jflex").
-
-      ##################################################################
-    </fail>
-  </target>
-
   <target name="compile-core" depends="init, clover"
           description="Compiles core classes">
     <compile
@@ -2197,7 +2161,15 @@
       </scp>
     </sequential>
   </macrodef>
-  
+
+  <!-- JFlex task -->
+  <target name="-install-jflex" unless="jflex.loaded" depends="ivy-availability-check,ivy-configure">
+    <ivy:cachepath organisation="de.jflex" module="jflex" revision="1.5.0"
+                   inline="true" conf="default" transitive="true" pathid="jflex.classpath"/>
+    <taskdef name="jflex" classname="jflex.anttask.JFlexTask" classpathref="jflex.classpath"/>
+    <property name="jflex.loaded" value="true"/>
+  </target>
+
   <!-- GROOVY scripting engine for ANT tasks -->
   <target name="resolve-groovy" unless="groovy.loaded" depends="ivy-availability-check,ivy-configure">
     <ivy:cachepath organisation="org.codehaus.groovy" module="groovy-all" revision="2.2.1"
