apache solr ant script : Big Project Ant Script « Ant « Java






apache solr ant script


<!-- Solr build file -->

<!--
 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.
-->

<project name="solr" default="usage" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
  
  <import file="common-build.xml"/>
  
  <!-- 3rd party libraries for compilation -->
  <property name="lib" location="lib" />

  <!-- solr source files -->
  <property name="src" location="src" />
  <property name="web.xml" location="${src}/webapp/web/WEB-INF/web.xml"/>

  <!-- Destination for distribution files (demo WAR, src distro, etc.) -->
  <property name="dist" location="dist" />

  

  <property name="clover.db.dir" location="${dest}/tests/clover/db"/>
  <property name="clover.report.dir" location="${dest}/tests/clover/reports"/>

    <available
            property="clover.present"
            classname="com.cenqua.clover.tasks.CloverReportTask"
            />
   <condition property="clover.enabled">
       <and>
           <isset property="run.clover"/>
           <isset property="clover.present"/>
       </and>
   </condition>
                 
  <!-- Default target: usage.  Prints out instructions. -->
  <target name="usage"
          description="Prints out instructions">
    <echo message="Welcome to the Solr project!" />
    <echo message="Use 'ant example' to create a runnable example configuration." />
    <echo message="Use 'ant run-example' to create and run the example." />
     <echo message="And for developers:"/>
    <echo message="Use 'ant clean' to clean compiled files." />
    <echo message="Use 'ant compile' to compile the source code." />
    <echo message="Use 'ant dist' to build the project WAR and JAR files." />
    <echo message="Use 'ant generate-maven-artifacts' to generate maven artifacts." />
    <echo message="Use 'ant package' to generate zip, tgz, and maven artifacts for distribution." />
    <echo message="Use 'ant luke' to start luke.  see: http://www.getopt.org/luke/" />
    <echo message="Use 'ant test' to run unit tests." />
  </target>

  <!-- Clean: cleans compiled files and other temporary artifacts. -->
  <target name="clean" depends="clean-contrib"
          description="Cleans compiled files and other temporary artifacts.">
    <delete dir="${dest}" />
    <delete dir="${dist}" />
    <delete dir="example/solr/lib" />
  </target>

  <target name="clean-dest"
          description="Cleans out ${dest} but leaves ${dist} alone.  This allows us to run nightly and clover together in Hudson">
    <delete includeemptydirs="true" >
      <fileset dir="${dest}">
        <exclude name="docs/"/>
      </fileset>
    </delete>
  </target>

  <!-- Prepares an entity file for use in Forrest documentation -->
  <target name="init-forrest-entities">
    <!-- no description, don't advertise -->


    <available file="lib/lucene-core-${lucene_version}.jar"
               property="lucene-version-ok-m2deploy-wont-fail" />
    <fail unless="lucene-version-ok-m2deploy-wont-fail">
      lib/lucene-core-${lucene_version}.jar Missing

      lib/lucene-core-${lucene_version}.jar does not exist.
      This will cause problems with m2-deploy later, so fail fast now.
      
      Probably cause: lucene jars were upgraded w/o modifying the
      'lucene_version' property in common-build.xml
    </fail>

    
    <mkdir dir="${dest}" />
    
    <!-- A folder containing the expanded war file -->
    <mkdir dir="${dest}/web" />
    
    <echo  file="${dest}/solr-specific-forrest-variables.ent" append="false">
      &lt;!ENTITY solr.specversion "${specversion}"&gt;
    </echo>
  </target>


  <!-- ------------------------------------------------------------------------= -->
  <!-- --------------------= COMPILATION-RELATED TASKS ------------------------= -->
  <!-- ------------------------------------------------------------------------= -->

  <!-- The compilation classpath -->
  <path id="compile.classpath">
    <fileset dir="${lib}">
      <include name="*.jar" />
    </fileset>
    <pathelement location="${dest}/common"/>
  </path>

  <target name="compile-solrj"
          description="Compile the java client."
          depends="init-forrest-entities">

    <solr-javac destdir="${dest}/solrj"
                classpathref="compile.classpath">
      <src path="${src}/common" />
      <src path="${src}/solrj" />
    </solr-javac>
  </target>


  <!-- This depend on all of solr -->
  <path id="compile.classpath.solrj">
    <path refid="compile.classpath" />
    <pathelement location="${dest}/solrj"/>
    <!-- jetty -->
    <fileset dir="example/lib">
      <include name="**/*.jar" />
    </fileset>
  </path>
    
  <!-- Compile the project. -->
  <target name="compile"
          description="Compile the source code."
          depends="compile-solrj,init-forrest-entities">

    <solr-javac destdir="${dest}/solr"
                classpathref="compile.classpath.solrj">
      <src path="${src}/java" />
      <src path="${src}/webapp/src" />
    </solr-javac>
  </target>

  <target name="javadoc-solrj" depends="compile-solrj" description="Generates solrj javadoc documentation.">
    <sequential>
      <mkdir dir="${build.javadoc}/solrj"/>

      <path id="javadoc.classpath">
        <path refid="compile.classpath"/>
      </path>

      <invoke-javadoc
        destdir="${build.javadoc}/solrj"
        title="${Name}-j ${version} API (${specversion})">
        <sources>
          <packageset dir="${src}/common"/>
          <packageset dir="${src}/solrj"/>
        </sources>
      </invoke-javadoc>
    </sequential>
  </target>
  
  <target name="javadoc-core" depends="compile"  description="Generates javadoc documentation for core.">

    <sequential>
      <mkdir dir="${build.javadoc}/solr"/>

      <path id="javadoc.classpath">
        <path refid="compile.classpath"/>
        <path refid="compile.classpath.solrj"/>
        <pathelement location="${dest}/solrj"/>
      </path>

      <invoke-javadoc
        destdir="${build.javadoc}/solr"
        title="${Name} ${version} core API (${specversion})">
        <sources>
          <packageset dir="${src}/java" />
          <packageset dir="${src}/webapp/src"/>
        </sources>
      </invoke-javadoc>
    </sequential>
  </target>


  <target name="javadoc-all" description="Generate javadoc for core, client and contrib">
    <sequential>
      <mkdir dir="${build.javadoc}"/>

      <path id="javadoc.classpath">
         <path refid="compile.classpath"/>
         <path refid="compile.classpath.solrj"/>
          <fileset dir="contrib">
            <include name="**/lib/**/*.jar"/>
          </fileset>
         <pathelement location="${dest}/client/solrj"/>
      </path>

      <invoke-javadoc destdir="${build.javadoc}">
        <sources>
          <packageset dir="${src}/common" />
          <packageset dir="${src}/solrj" />
          <packageset dir="${src}/java" />
          <packageset dir="${src}/webapp/src" />
          <packageset dir="contrib/dataimporthandler/src/main/java" />
          <packageset dir="contrib/clustering/src/main/java" />
          <packageset dir="contrib/extraction/src/main/java" />
          <group title="Core" packages="org.apache.*" />
          <group title="Common" packages="org.apache.solr.common.*" />
          <group title="SolrJ" packages="org.apache.solr.client.solrj*" />
          <group title="contrib: DataImportHandler" packages="org.apache.solr.handler.dataimport*" />
          <group title="contrib: Clustering" packages="org.apache.solr.handler.clustering*" />
          <group title="contrib: Solr Cell" packages="org.apache.solr.handler.extraction*" />
        </sources>
      </invoke-javadoc>
    </sequential>
  </target>

  <target name="javadoc-contrib" description="Generate javadoc for contrib classes" depends="build-contrib">
    <contrib-crawl target="javadoc"
                   failonerror="true"/>
  </target>

  <target name="javadoc" depends="javadoc-core, javadoc-contrib, javadoc-solrj, javadoc-all">
  </target>

  <target name="stub-factories" depends="dist-jar"
          description="Generates stub factories as needed">

    <path id="stub.jars">
      <!-- this needs to be a list of all jars that might contain
           classes we want to build factories for
        -->
      <fileset dir="${lib}">
        <include name="lucene-*.jar"/>
      </fileset>
      <fileset dir="${dist}">
        <include name="*.jar"/>
        <exclude name="*solrj*.jar"/>
      </fileset>
    </path>
    <pathconvert property="jar.list" pathsep=" " refid="stub.jars" />
    <property name="stub.list" value="${dest}/need-stub-factories.txt" />
    <java fork="false" 
          classname="org.apache.solr.util.SuggestMissingFactories"
          logError="true"
          failonerror="true"
          classpathref="test.run.classpath"
          output="${stub.list}">
      <arg line="${jar.list}" />
    </java>
    <fail unless="stub.src.path">...
    
  This task requires that the property 'stub.src.path' be set.
      
  It must contain a "path" listing directories containing source
  files that this task should use when looking for classes that
  need factories created, the format is platform specific --
  typically it is  colon seperated in Unix, semi-colon seperated
  on windows, ie:

  ant stub-factories -Dstub.src.path="./src:../lucene/contrib:../lucene/src/java"
      
  FYI: The file ${stub.list} contains a list of classes
  that seem to need stub factories. (if java files can be found to
  use as guides for creating them).
    </fail>              

    <pathconvert pathsep=" " property="stub.src.dirs">
      <path>
        <pathelement path="${stub.src.path}"/>
      </path>
    </pathconvert>
    <exec executable="${basedir}/src/dev-tools/stub-analysis-factory-maker.pl" 
          dir="src/java/org/apache/solr/analysis/"
          failonerror="true">
        <redirector input="${stub.list}">
           <!-- place to put special case classes we want to ignore -->
           <inputfilterchain>
              <linecontainsregexp negate="true">
                 <!-- only for internal Solr highlighting purposes -->
                 <regexp pattern="TokenOrderingFilter"/>
              </linecontainsregexp>
              <linecontainsregexp negate="true">
                 <!-- no way to leverage this in Solr -->
                 <regexp pattern="CachingTokenFilter"/>
              </linecontainsregexp>
              <linecontainsregexp negate="true">
                 <!-- no way to leverage this in Solr -->
                 <regexp pattern="HyphenationCompoundWordTokenFilter"/>
              </linecontainsregexp>
              <linecontainsregexp negate="true">
                 <!-- no way to leverage these in Solr (yet) -->
                 <regexp pattern="Sink|Tee"/>
              </linecontainsregexp>
              <linecontainsregexp negate="true">
                 <!-- Solr already has a different impl for this -->
                 <regexp pattern="SynonymTokenFilter"/> 
              </linecontainsregexp>
              <linecontainsregexp negate="true">
                 <!-- solr and lucene both have one? ? ? ? -->
                 <regexp pattern="LengthFilter"/> 
              </linecontainsregexp>
              <linecontainsregexp negate="true">
                 <!-- solr provides it's own SnowballPorterFilter variant -->
                 <regexp pattern="SnowballFilter"/> 
              </linecontainsregexp>
           </inputfilterchain>
        </redirector>
      <arg line="${stub.src.dirs}"/>
    </exec>
  </target>


  <!-- ------------------------------------------------------------------------= -->
  <!-- --------------------= TESTING-RELATED TASKS ----------------------------= -->
  <!-- ------------------------------------------------------------------------= -->


  <!-- Classpath for unit test compilation. -->
  <!-- For now, it's the same as main classpath.  Later it will have JUnit, Clover, etc. -->
  <path id="test.compile.classpath">
    <path refid="compile.classpath" />
    <path refid="compile.classpath.solrj" />
      
    <pathelement location="${dest}/solr"/>
    <pathelement location="${dest}/solrj"/> <!-- include solrj -->
  </path>

  <path id="test.run.classpath">
    <path refid="test.compile.classpath" />
      <pathelement location="${dest}/tests"/>
      
      <!-- include the solrj classpath and jetty files included in example -->
    <path refid="compile.classpath.solrj" />
    
    <pathelement path="${java.class.path}"/>
  </path>

  <!-- Compile unit tests. -->
  <target name="compileTests"
          description="Compile unit tests."
          depends="compile,compile-solrj">

    <mkdir dir="${dest}/tests" />
    <solr-javac 
       destdir="${dest}/tests"
       classpathref="test.compile.classpath">
      <src path="${src}/test" />
    </solr-javac>
  </target>

  <!-- Run core unit tests. -->
  <target name="test-core"
          description="Runs the core unit tests."
          depends="init-forrest-entities, compileTests, junit" />
  
  <!-- Run contrib unit tests. -->
  <target name="test"
        description="Runs the core unit tests."
        depends="test-core, test-contrib" />

  <target name="junit" depends="compileTests,dist-contrib">
    
    <!-- no description so it doesn't show up in -projecthelp -->  
    <mkdir dir="${junit.output.dir}"/>
    <condition property="runall">
      <not>
        <or>
          <isset property="testcase"/>
          <isset property="testpackage"/>
          <isset property="testpackageroot"/>
        </or>
      </not>
    </condition>
    <junit printsummary="on"
           haltonfailure="no"
           errorProperty="tests.failed"
           failureProperty="tests.failed"
           dir="src/test/test-files/"
           >
      <jvmarg line="${args}"/>
      <formatter type="brief" usefile="false" if="junit.details"/>
      <classpath refid="test.run.classpath"/>
      <formatter type="${junit.formatter}"/>
      <batchtest fork="yes" todir="${junit.output.dir}" if="runall">
        <fileset dir="src/test" includes="${junit.includes}"/>
      </batchtest>
      <batchtest fork="yes" todir="${junit.output.dir}" if="testpackage">
        <fileset dir="src/test" includes="**/${testpackage}/**/Test*.java,**/${testpackage}/**/*Test.java"/>
      </batchtest>
      <batchtest fork="yes" todir="${junit.output.dir}" if="testpackageroot">
        <fileset dir="src/test" includes="**/${testpackageroot}/Test*.java,**/${testpackageroot}/*Test.java"/>
      </batchtest>
      <batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
        <fileset dir="src/test" includes="**/${testcase}.java"/>
      </batchtest>
    </junit>

    <fail if="tests.failed">Tests failed!</fail>
  </target>
      
  <target name="test-reports"
          description="Generates HTML test reports.">
    <mkdir dir="${junit.reports}"/>
    <junitreport todir="${junit.output.dir}">
      <fileset dir="${junit.output.dir}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${junit.reports}"/>
    </junitreport>
  </target>

  <target name="clover" depends="clover.setup, clover.info"
          description="Instrument the Unit tests using Clover.  Requires a Clover license and clover.jar in the ANT classpath.  To use, specify -Drun.clover=true on the command line."/>

  <target name="clover.setup" if="clover.enabled">
    <taskdef resource="clovertasks"/>
    <mkdir dir="${clover.db.dir}"/>
    <clover-setup initString="${clover.db.dir}/solr_coverage.db">
      <fileset dir="src/common"/>
      <fileset dir="src/solrj"/>
      <fileset dir="src/java"/>
      <fileset dir="src/webapp/src"/>
      <fileset dir="contrib/dataimporthandler/src/main/java" />
      <fileset dir="contrib/clustering/src/main/java" />
      <fileset dir="contrib/extraction/src/main/java" />
    </clover-setup>
  </target>

  <target name="clover.info" unless="clover.present">
    <echo>
      Clover not found. Code coverage reports disabled.
    </echo>
  </target>

  <target name="clover.check">
  <fail unless="clover.present">
    ##################################################################
      Clover not found.
      Please make sure clover.jar is in ANT_HOME/lib, or made available
      to Ant using other mechanisms like -lib or CLASSPATH.
      ##################################################################
    </fail>
  </target>
    <!--
     Run after Junit tests.
     -->
  <target name="generate-clover-reports" depends="clover.check, clover">
    <mkdir dir="${clover.report.dir}"/>
    <clover-report>
       <current outfile="${clover.report.dir}/clover.xml"
                title="${fullnamever}">
          <format type="xml"/>
       </current>
       <current outfile="${clover.report.dir}" title="${fullnamever}">
          <format type="html"/>
       </current>
    </clover-report>
  </target>


  <!-- ------------------------------------------------------------------------= -->
  <!-- --------------------= DISTRIBUTION-RELATED TASKS ------------------------ -->
  <!-- ------------------------------------------------------------------------= -->


  <!-- Creates the Solr distribution files. -->
  <target name="dist"
          description="Creates the Solr distribution files."
          depends="init-forrest-entities, dist-solrj, dist-jar, dist-contrib, dist-war" />

  <!-- Creates the Solr WAR file. -->
  <target name="dist-war"
          description="Creates the Solr WAR Distribution file."
          depends="compile, make-manifest, dist-jar, dist-solrj">
    <mkdir dir="${dist}" />
    <war destfile="${dist}/${fullnamever}.war"
         webxml="${web.xml}"
         filesetmanifest="skip"
         manifest="${dest}/META-INF/MANIFEST.MF">
       <lib dir="${lib}">
         <exclude name="servlet-api*.jar" />
         <exclude name="easymock.jar" />
         <exclude name="junit-*.jar" />
         <exclude name="*.txt" />
         <exclude name="*.template" />
       </lib>
       <lib dir="${dist}">
         <include name="${fullname}-solrj-${version}.jar" />
         <include name="${fullname}-core-${version}.jar" />
       </lib>
       <fileset dir="${src}/webapp/web" />
       
       <!-- Include anything put in by contrib projects -->
       <fileset dir="${dest}/web" />
         
       <metainf dir="${basedir}" includes="LICENSE.txt,NOTICE.txt"/>
    </war>
  </target>

  <target name="dist-src" description="Creates the Solr source distribution files"
          depends="make-manifest">
    <mkdir dir="${dist}" />

    <solr-jar destfile="${dist}/${fullname}-solrj-src-${version}.jar">
      <fileset dir="${src}/common" />
      <fileset dir="${src}/solrj"/>
    </solr-jar>
      
    <solr-jar destfile="${dist}/${fullname}-core-src-${version}.jar">
      <fileset dir="${src}/java" />
      <fileset dir="${src}/webapp/src"/>
    </solr-jar>
    
    <solr-jar destfile="${dist}/apache-solr-dataimporthandler-src-${version}.jar"
              basedir="contrib/dataimporthandler/src/main/java" />
    <solr-jar destfile="${dist}/apache-solr-dataimporthandler-extras-src-${version}.jar"
              basedir="contrib/dataimporthandler/src/extras/main/java" />

    <solr-jar destfile="${dist}/apache-solr-cell-src-${version}.jar"
              basedir="contrib/extraction/src" />
    <solr-jar destfile="${dist}/apache-solr-velocity-src-${version}.jar"
              basedir="contrib/velocity/src" />
    <solr-jar destfile="${dist}/apache-solr-clustering-src-${version}.jar"
              basedir="contrib/clustering/src" />
  </target>

  <target name="dist-javadoc" description="Creates the Solr javadoc distribution files"
          depends="make-manifest, javadoc">
    <mkdir dir="${dist}" />

    <solr-jar destfile="${dist}/${fullname}-core-docs-${version}.jar"
              basedir="${build.javadoc}/solr" />
    <solr-jar destfile="${dist}/${fullname}-solrj-docs-${version}.jar"
              basedir="${build.javadoc}/solrj" />
    <solr-jar destfile="${dist}/apache-solr-dataimporthandler-docs-${version}.jar"
              basedir="${build.javadoc}/contrib-solr-dataimporthandler" />
    <solr-jar destfile="${dist}/apache-solr-clustering-docs-${version}.jar"
              basedir="${build.javadoc}/contrib-solr-clustering" />
    <solr-jar destfile="${dist}/apache-solr-velocity-docs-${version}.jar"
              basedir="${build.javadoc}/contrib-solr-velocity" />
    <solr-jar destfile="${dist}/apache-solr-cell-docs-${version}.jar"
              basedir="${build.javadoc}/contrib-solr-cell" />
  </target>

  <!-- Creates the solr jar. -->
  <target name="dist-jar"
          description="Creates the Solr JAR Distribution file."
          depends="compile, make-manifest">
    <mkdir dir="${dist}" />
    <solr-jar destfile="${dist}/${fullname}-core-${version}.jar">
      <fileset dir="${dest}/solr" />
    </solr-jar>

  </target>

  <!-- Creates the solr jar. -->
  <target name="dist-solrj"
          description="Creates the Solr JAR Distribution file."
          depends="compile-solrj, make-manifest">
    <mkdir dir="${dist}" />
    <solr-jar
         destfile="${dist}/${fullname}-solrj-${version}.jar"
         basedir="${dest}/solrj" />

    <mkdir  dir="${dist}/solrj-lib" />
    <copy todir="${dist}/solrj-lib">
      <fileset dir="${lib}">
        <include name="commons-codec-*.jar"/>
        <include name="commons-io-*.jar"/>
        <include name="commons-httpclient-*.jar"/>
        <include name="*stax-*.jar" />
        <include name="wstx-*.jar" />
        <include name="jcl-over-slf4j-*.jar" />
        <include name="slf4j-api-*.jar" />
      </fileset>
    </copy>
      
  </target>

  <target name="example" 
          description="Creates a runnable example configuration."
          depends="init-forrest-entities,dist-contrib,dist-war,example-contrib">
    <copy file="${dist}/${fullnamever}.war"
          tofile="${example}/webapps/${ant.project.name}.war"/>
    <jar destfile="${example}/exampledocs/post.jar"
         basedir="${dest}/solr"
         filesetmanifest="skip"
         includes="org/apache/solr/util/SimplePostTool*.class">
       <manifest>
          <attribute name="Main-Class"
                     value="org.apache.solr.util.SimplePostTool"/>
       </manifest>
    </jar>

    <delete includeemptydirs="true">
      <fileset dir="${example}/work" includes="**/*"/>
    </delete>
    <echo>See ${example}/README.txt for how to run the Solr example configuration.</echo>
  </target>
  
  <target name="run-example" depends="example">
    <property name="example.solr.home" location="example/solr"/>
    <property name="example.data.dir" location="example/solr/data"/>
    <property name="example.debug.suspend" value="n"/>
    <property name="example.jetty.port" value="8983"/>
    <condition property="example.jvm.line" value="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=${example.debug.suspend},address=5005">
      <isset property="example.debug"/>
    </condition>
    <property name="example.jvm.line" value=""/>
    <property name="example.heap.size" value="512M"/>
    <java jar="${example}/start.jar" fork="true" dir="${example}" maxmemory="${example.heap.size}">
      <jvmarg line="${example.jvm.line}"/>
      <sysproperty key="solr.solr.home" file="${example.solr.home}"/>
      <sysproperty key="solr.data.dir" file="${example.data.dir}"/>
      <sysproperty key="jetty.port" value="${example.jetty.port}"/>
    </java>

  </target>

  <!-- make a distribution -->
  <target name="package" depends="generate-maven-artifacts"/>

  <target name="create-package"
          description="Packages the Solr Distribution files and Documentation."
          depends="dist, example, javadoc, dist-src, dist-javadoc">

    <copy failonerror="false" todir="${build.docs}">
      <fileset dir="site" />
    </copy>

    <delete file="${dist}/${fullnamever}.tgz" failonerror="false" />
    <delete file="${dist}/${fullnamever}.zip" failonerror="false" />

    <tar destfile="${dist}/${fullnamever}.tgz" compression="gzip" longfile="gnu">
      <tarfileset dir="."
        prefix="${fullnamever}"
        includes="LICENSE.txt NOTICE.txt *.txt *.xml lib/** src/** example/** client/** contrib/"
        excludes="lib/README.committers.txt **/data/ **/logs/* **/classes/ **/*.sh **/bin/ src/scripts/ src/site/build/ **/target/ client/ruby/flare/ client/python contrib/**/build/ **/*.iml **/*.ipr **/*.iws contrib/clustering/example/lib/** contrib/clustering/lib/downloads/**" />
      <tarfileset dir="."
        prefix="${fullnamever}"
        includes="src/test/test-files/solr/lib/classes/empty-file-main-lib.txt" />
      <tarfileset dir="."
        mode="755"
        prefix="${fullnamever}"
        includes="**/*.sh **/bin/ src/scripts/" />
      <tarfileset dir="."
        prefix="${fullnamever}"
        includes="dist/**"
        excludes="*.tgz *.zip *.md5 **/*src*.jar **/*docs*.jar" />
      <tarfileset dir="${build.docs}"
        prefix="${fullnamever}/docs/" />
    </tar>
    <solr-checksum file="${dist}/${fullnamever}.tgz"/>

    <gunzip src="${dist}/${fullnamever}.tgz" dest="${dest}/${fullnamever}.tar"/>
    <untar src="${dest}/${fullnamever}.tar" dest="${dest}"/>

    <fixcrlf srcdir="${dest}/${fullnamever}"
       eol="crlf"
       includes="**/*.txt **/*.xml **/*.java **/*.html **/*.csv **/*.css **/*.properties **/*.jsp **/*.xsl **/*.py **/*.rb **/*.js **/*.json **/*.pl"
     />

    <zip destfile="${dist}/${fullnamever}.zip">
      <zipfileset dir="${dest}/${fullnamever}"
        prefix="${fullnamever}" 
        excludes="**/*.sh **/bin/ src/scripts/" />
      <zipfileset dir="${dest}/${fullnamever}"
        prefix="${fullnamever}"
        includes="**/*.sh **/bin/ src/scripts/"
        filemode="755" />
    </zip>
    <solr-checksum file="${dist}/${fullnamever}.zip"/>

  </target>

    <target name="build-site" depends="svn-up, init-forrest-entities" description="Prototype Helper for Committers.  Assumes SVN is in the path">
    <delete dir="src/site/build"/>
    <exec executable="forrest" dir="src/site"/>
    <copy todir="site">
      <fileset dir="src/site/build/site"/>
    </copy>
    <exec executable="svn" dir="site">
      <arg value="ci"/>
      <arg value="-m"/>
      <arg value="&quot;Forrest Entity updates&quot;"/>
    </exec>
    <exec executable="svn" dir="src/site">
                    <arg value="ci"/>
                    <arg value="-m"/>
                    <arg value="&quot;Forrest Entity updates&quot;"/>
            </exec>
    <antcall target="svn-up"/>

  </target>
  <target name="svn-up">
    <exec executable="svn">
      <arg value="update"/>
    </exec>
  </target>

  <target name="clean-dist-signatures">
    <delete failonerror="false">
      <fileset dir="${dist}">
        <include name="**/*.asc"/>
      </fileset>
    </delete>
  </target>
  <target name="sign-artifacts" depends="clean-dist-signatures">
    <!--<input message="Enter signature passphrase" addproperty="passphrase"/>
    <touch file="${user.home}/.pwd.txt"/>
    <chmod file="${user.home}/.pwd.txt" perm="600"/>
    <echo file="${user.home}/.pwd.txt">${passphrase}</echo>-->
    <sign-artifact input.file="${dist}/${fullnamever}.tgz" output.file="${dist}/${fullnamever}.tgz.asc"/>
    <sign-artifact input.file="${dist}/${fullnamever}.zip" output.file="${dist}/${fullnamever}.zip.asc"/>

    <!-- Maven artifacts -->
    <sign-maven-dependency-artifacts artifact.id="solr-commons-csv"/>
    <sign-maven-artifacts artifact.id="solr-core"/>
    <sign-maven-artifacts artifact.id="solr-dataimporthandler"/>
    <sign-maven-artifacts artifact.id="solr-dataimporthandler-extras"/>
    <sign-maven-artifacts artifact.id="solr-clustering"/>

    <sign-maven-artifacts artifact.id="solr-cell"/>
    <sign-maven-dependency-artifacts artifact.id="solr-lucene-analyzers"/>
    <sign-maven-dependency-artifacts artifact.id="solr-lucene-core"/>
    <sign-maven-dependency-artifacts artifact.id="solr-lucene-highlighter"/>
    <sign-maven-dependency-artifacts artifact.id="solr-lucene-queries"/>
    <sign-maven-dependency-artifacts artifact.id="solr-lucene-snowball"/>
    <sign-maven-dependency-artifacts artifact.id="solr-lucene-spellchecker"/>
    <sign-maven-artifacts artifact.id="solr-solrj"/>
    <sign-maven-artifacts artifact.id="solr-velocity"/>

    <!-- Thes are special since there are no jars, just poms -->
    <sign-artifact input.file="${maven.dist.prefix}/solr-parent/${maven_version}/solr-parent-${maven_version}.pom"/>
    <sign-artifact input.file="${maven.dist.prefix}/solr-lucene-contrib/${maven_version}/solr-lucene-contrib-${maven_version}.pom"/>

    <!--<delete file="${user.home}/.pwd.txt"/>-->
  </target>




  <target name="prepare-release" depends="clean, svn-up, build-site, package, sign-artifacts" description="Prototype helper for Committers.  Assumes gpg is in the path">

    <tar destfile="${dist}/solr-maven.tar" longfile="gnu">
      <tarfileset dir="${dist}/maven" prefix="maven"/>
    </tar>
  <tar destfile="${dist}/solr.tar" longfile="gnu">
    <tarfileset dir="${dist}" includes="${fullnamever}.* solr-maven.tar" excludes="${fullnamever}.war"/>
  </tar>
  </target>

  <target name="generate-maven-artifacts" depends="maven.ant.tasks-check, create-package">
    <sequential>

      <!--

       !!!!!!!!!!
       NOTE:  If you add new artifacts, please make sure you also add to the sign-artifacts target
       so that they get signed during release.
      !!!!!!!
       -->

      <mkdir dir="${maven.build.dir}"/>
      <mkdir dir="${maven.dist.dir}"/>

      <!-- --------== SOLR PARENT POM --------== -->

      <m2-deploy pom.xml="src/maven/solr-parent-pom.xml.template"/>

      <!-- --------== SOLR SPECIFIC COMMONS CSV --------== -->
      <m2-deploy  pom.xml="lib/solr-commons-csv-pom.xml.template"
                  jar.file="lib/commons-csv-1.0-SNAPSHOT-r609327.jar" />

      <!-- --------== SOLR ARTIFACTS --------== -->

      <m2-deploy pom.xml="contrib/dataimporthandler/solr-dataimporthandler-pom.xml.template"
                 jar.file="${dist}/apache-solr-dataimporthandler-${version}.jar">
        <artifact-attachments>
          <attach file="${dist}/apache-solr-dataimporthandler-src-${version}.jar" classifier="sources"/>
          <attach file="${dist}/apache-solr-dataimporthandler-docs-${version}.jar" classifier="javadoc"/>
        </artifact-attachments>
      </m2-deploy>

      <m2-deploy pom.xml="contrib/dataimporthandler/solr-dataimporthandler-extras-pom.xml.template"
                 jar.file="${dist}/apache-solr-dataimporthandler-extras-${version}.jar">

        <artifact-attachments>
          <attach file="${dist}/apache-solr-dataimporthandler-extras-src-${version}.jar" classifier="sources"/>
          <attach file="${dist}/apache-solr-dataimporthandler-docs-${version}.jar" classifier="javadoc"/>
        </artifact-attachments>
      </m2-deploy>

      <m2-deploy pom.xml="contrib/extraction/solr-cell-pom.xml.template"
                 jar.file="${dist}/apache-solr-cell-${version}.jar">
        <artifact-attachments>
          <attach file="${dist}/apache-solr-cell-src-${version}.jar" classifier="sources"/>
          <attach file="${dist}/apache-solr-cell-docs-${version}.jar" classifier="javadoc"/>
        </artifact-attachments>
      </m2-deploy>

      <m2-deploy pom.xml="contrib/clustering/solr-clustering-pom.xml.template"
      jar.file="${dist}/apache-solr-clustering-${version}.jar">

        <artifact-attachments>
          <attach file="${dist}/apache-solr-clustering-src-${version}.jar" classifier="sources"/>
          <attach file="${dist}/apache-solr-clustering-docs-${version}.jar" classifier="javadoc"/>
        </artifact-attachments>
      </m2-deploy>
      <!-- Clustring specific -->
      <!-- TODO: MORE NEEDED HERE ONCE WE FINALIZE THE LIBS FOR CARROT -->
      <!-- end clustering specific -->

      <m2-deploy pom.xml="contrib/velocity/solr-velocity-pom.xml.template"
      jar.file="contrib/velocity/src/main/solr/lib/apache-solr-velocity-${version}.jar">

        <artifact-attachments>
          <attach file="${dist}/apache-solr-velocity-src-${version}.jar" classifier="sources"/>
          <attach file="${dist}/apache-solr-velocity-docs-${version}.jar" classifier="javadoc"/>
        </artifact-attachments>
      </m2-deploy>

      <m2-deploy pom.xml="src/maven/solr-core-pom.xml.template"
                 jar.file="${dist}/apache-solr-core-${version}.jar">

        <artifact-attachments>
          <attach file="${dist}/apache-solr-core-src-${version}.jar" classifier="sources"/>
          <attach file="${dist}/apache-solr-core-docs-${version}.jar" classifier="javadoc"/>
        </artifact-attachments>

      </m2-deploy>

      <m2-deploy pom.xml="src/maven/solr-solrj-pom.xml.template"
                 jar.file="${dist}/apache-solr-solrj-${version}.jar">

        <artifact-attachments>
          <attach file="${dist}/apache-solr-solrj-src-${version}.jar" classifier="sources"/>
          <attach file="${dist}/apache-solr-solrj-docs-${version}.jar" classifier="javadoc"/>
        </artifact-attachments>

      </m2-deploy>

    </sequential>
  </target>

  <target name="nightly"
          depends="test, create-package">
     <!-- no description, don't advertise -->
  </target>
  <target name="-taskdef">
    <typedef resource="org/apache/rat/anttasks/antlib.xml" uri="antlib:rat.anttasks">
      <classpath>
        <fileset dir="." includes="rat*.jar"/>
      </classpath>
    </typedef>
  </target>
  <target name="rat-sources" depends="-taskdef"
    description="runs the tasks over src/java excluding the license directory">
    <rat:report xmlns:rat="antlib:org.apache.rat.anttasks">
      <fileset dir="src/java"/>
      <fileset dir="src/common"/>
      <fileset dir="src/solrj"/>
      <fileset dir="client">
        <exclude name="**/CHANGES.*"/>
      </fileset>
      <fileset dir="contrib/dataimporthandler/src/main/java"/>
      <fileset dir="contrib/dataimporthandler/src/test/java"/>
      <fileset dir="contrib/clustering/src/main/java"/>
      <fileset dir="contrib/clustering/src/test/java"/>
      <fileset dir="contrib/extraction/src/main/java"/>
      <fileset dir="contrib/extraction/src/test/java"/>
    </rat:report>
  </target>

  
  <!-- ------------------------------------------------------------------------= -->
  <!-- --------------------= Runtime: luke         ----------------------------= -->
  <!-- ------------------------------------------------------------------------= -->

  <available file="luke/luke-0.9.9.jar" property="luke.jar.exists" />
  <target name="luke-download" unless="luke.jar.exists" depends="proxy.setup">
    <mkdir dir="luke"/>
    <get src="http://www.getopt.org/luke/luke-0.9.9/luke-0.9.9.jar" 
        dest="luke/luke-0.9.9.jar"/>
    <get src="http://people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/lucene/lucene-misc/2.9.0/lucene-misc-2.9.0.jar" 
        dest="luke/lucene-misc-2.9.0.jar" />
  </target>
  
  <target name="luke" depends="luke-download">
    <java fork="true" 
          classname="org.getopt.luke.Luke"
          logError="true"
          failonerror="true">
      <classpath>
        <fileset dir="${lib}">
          <include name="*.jar" />
        </fileset>
        <fileset dir="luke">
          <include name="luke-0.9.9.jar"/>
          <include name="lucene-misc-2.9.0.jar"/>
        </fileset>
       </classpath>
    </java>
  </target>

</project>


File: common-build.xml

<!--
 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.
-->

<project name="common" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
  <description>
    This file is designed for importing into a main build file, and not intended
    for standalone use.
  </description>

  <dirname file="${ant.file.common}" property="common.dir"/>
  
  <!-- Initialize property values: allow easy customization via build.properties -->
  <property file="build.properties" />

  <property name="Name" value="Solr" />

  <property name="name" value="${ant.project.name}"/>

  <tstamp>
    <format property="year" pattern="yyyy"/>
    <format property="DSTAMP" pattern="yyyy-MM-dd"/>
    <format property="TSTAMP" pattern="HH:mm:ss"/>
    <!-- datetime format that is safe to treat as part of a dotted version -->
    <format property="dateversion" pattern="yyyy.MM.dd.HH.mm.ss" />
  </tstamp>

  <!-- default arguments to pass to jvm executing tests -->
  <property name="args" value="" />

  <!-- Example directory -->
  <property name="example" value="${common.dir}/example" />
  <!-- 
    we attempt to exec svnversion to get details build information
    for jar manifests.  this property can be set at runtime to an
    explicit path as needed, or ant will just try to find it in the
    default PATH. (this is useful for Hudson)
  -->
  <property name="svnversion.exe" value="svnversion" />

  <!-- Java Version we are compatible with -->
  <property name="java.compat.version" value="1.5" />

  <!-- Solr Implementation Version -->
  <!--
       This can be any string value that does not include spaces
       This will be used when creating build artifact file names.

       By default, this should be set to "X.Y.N-dev" where X.Y.N is
       "1 greater" then the last version released (on this branch).
    -->
  <property name="version" value="1.4.1-dev" />
  
  <!-- Solr Specification Version -->
  <!--
       This will be used in the Manifest file, and therefore must
       match the pattern "digit+{.digit+}*"
       
       By default, this should be set to "X.Y.M.${dateversion}"
       where X.Y.M is the last version released (on this branch).
    -->
  <property name="specversion" value="1.4.0.${dateversion}" />

  
    <!-- Type of checksum to compute for distribution files -->
  <property name="checksum.algorithm" value="md5" />
  
  <property name="fullname" value="apache-${ant.project.name}"/>
  <property name="fullnamever" value="apache-${ant.project.name}-${version}"/>

  <!-- Destination for compiled classes and binaries -->
  <property name="dest" value="build" />

  <!-- Javadoc properties -->
  <property name="javadoc.years" value="2006 - ${year}" />
  <property name="javadoc.access" value="protected"/>
  <property name="javadoc.link.java"
            value="http://java.sun.com/j2se/1.5.0/docs/api/"/>
  <property name="javadoc.link.junit"
            value="http://junit.sourceforge.net/javadoc/"/>
  <property name="javadoc.link.lucene"
            value="http://lucene.apache.org/java/2_9_0/api/all/"/>
  <property name="javadoc.packages" value="org.apache.solr.*"/>
  <property name="build.docs" value="${dest}/docs"/>
  <property name="build.javadoc" value="${common.dir}/${build.docs}/api"/>
  <property name="build.javadoc.solrj" value="${build.docs}/api-solrj"/>
  
  <!-- JUnit properties -->
  <property name="junit.includes" value="**/Test*.java,**/*Test.java"/>
  <property name="junit.output.dir" location="${common.dir}/${dest}/test-results"/>
  <property name="junit.reports" location="${common.dir}/${dest}/test-results/reports"/>
  <property name="junit.formatter" value="plain"/>

  <!-- Maven properties -->
  <property name="maven.build.dir" value="${basedir}/build/maven"/>
  <property name="maven.dist.dir" value="${basedir}/dist/maven"/>

  <property name="maven.dist.prefix" value="${maven.dist.dir}/org/apache/solr"/>

  <!-- 
       The version suffix of the Lucene artifacts checked into "lib" 
       IF YOU CHANGE THIS, SANITY CHECK "javadoc.link.lucene"
  -->
  <property name="lucene_version" value="2.9.1"/>
  <!-- The version number to assign to the Maven artifacts. -->
  <property name="maven_version" value="1.4.1-SNAPSHOT"/>

  <!-- By default, "deploy" to a temporary directory (as well as installing
       into your local repository).  If you wish to deploy to a remote
       repository, set this property to the URL of that repository.  In
       addition, if the repository requires authentication, you can set
       properties "m2.repository.username" and "m2.repository.private.key"
       to define your credentials.
  -->
  <property name="m2.repository.url" value="file://${maven.dist.dir}"/>
  <property name="m2.repository.private.key" value="${user.home}/.ssh/id_dsa"/>

  <available property="maven.ant.tasks.present" classname="org.apache.maven.artifact.ant.Pom" />

  <!-- End Maven Properties -->

  <available property="clover.present"
            classname="com.cenqua.clover.tasks.CloverReportTask"
            />
   <condition property="clover.enabled">
       <and>
           <isset property="run.clover"/>
           <isset property="clover.present"/>
       </and>
   </condition>
   
   
  <!-- Macro for compilation -->
  <macrodef name="solr-javac">
    <attribute name="destdir" />
    <attribute name="classpathref" />
    <element name="nested" optional="true" implicit="true" />
    <sequential>
      <mkdir dir="@{destdir}" />
      <javac destdir="@{destdir}"
             target="${java.compat.version}"
             source="${java.compat.version}"
             debug="on"
             encoding="utf8"
             sourcepath=""
             classpathref="@{classpathref}">
         <nested />
      </javac>
    </sequential>
  </macrodef>

  <!-- Macro for building Jars -->
  <macrodef name="solr-jar">
    <attribute name="destfile" />
    <attribute name="basedir" default="." />
    <attribute name="includes" default="org/apache/**" />
    <attribute name="excludes" default="" />
    <attribute name="manifest" default="${common.dir}/${dest}/META-INF/MANIFEST.MF" />
    <element name="nested" optional="true" implicit="true" />
    <sequential>
      <jar destfile="@{destfile}"
           basedir="@{basedir}"
           includes="@{includes}"
           excludes="@{excludes}"
           filesetmanifest="skip"
           manifest="@{manifest}">
        <metainf dir="${common.dir}" includes="LICENSE.txt,NOTICE.txt"/>
        <nested />
      </jar>
    </sequential>
  </macrodef>

  <!-- Macro for building checksum files
       This is only needed until the "format" option is supported
       by ant's built in checksum task
   -->
  <macrodef name="solr-checksum">
    <attribute name="file"/>
    <!-- NOTE: we use the value of @{file} in the names any properties
         set because macro's don't have variables, and otherwise we
         wouldn't be able to checksum more then one file per build
      -->
    <sequential>
     <checksum file="@{file}"
               property="@{file}.sum"
               algorithm="${checksum.algorithm}" />
     <basename file="@{file}" property="@{file}.base" />
     <concat destfile="@{file}.${checksum.algorithm}"
             force="yes"
             append="false"
             fixlastline="yes">
       <header trimleading="yes">${@{file}.sum}  </header>
       <!-- empty fileset to trick concat -->
       <fileset dir="." excludes="**" />
       <footer trimleading="yes">${@{file}.base}
       </footer>
     </concat>
    </sequential>
  </macrodef>


  <macrodef name="contrib-crawl">
    <attribute name="target" default=""/>
    <attribute name="failonerror" default="true"/>
    <sequential>
      <subant target="@{target}" failonerror="@{failonerror}">
        <fileset dir="."
                 includes="contrib/*/build.xml"
        />
      </subant>
    </sequential>
  </macrodef>

  <macrodef name="invoke-javadoc">
    <element name="sources" optional="yes"/>
    <attribute name="destdir"/>
    <attribute name="title" default="${Name} ${version} API (${specversion})"/>
    <sequential>
      <javadoc
          packagenames="org.apache.solr.*"
          failonerror="true"
          destdir="@{destdir}"
          access="${javadoc.access}"
          encoding="utf-8"
          author="true"
          version="true"
          use="true"
          source="${ant.java.version}"
          link="${javadoc.link.java}"
          windowtitle="${Name} ${version} API"
          doctitle="@{title}"
          bottom="Copyright &amp;copy; ${year} Apache Software Foundation.  All Rights Reserved.">
        <tag name="todo" description="To Do:"/>
        <tag name="uml.property" description="UML Property:"/>
        <link offline="true" packagelistLoc="${build.javadoc}"/>
        <link href="${javadoc.link.java}"/>
        <link href="${javadoc.link.junit}"/>
        <link href="${javadoc.link.lucene}"/>

        <sources />

        <classpath refid="javadoc.classpath"/>
      </javadoc>
   </sequential>
  </macrodef>

  <!-- NOTE, the pom.xml MUST be a relative path.  An absolute path may break the build on windows -->
  <macrodef name="m2-deploy" description="Builds a Maven artifact">
        <element name="artifact-attachments" optional="yes"/>
    <attribute name="pom.xml" default="${pom.xml}"/>
    <attribute name="jar.file" default="${jar.file}"/>
    <sequential>
      <copy file="@{pom.xml}" tofile="${maven.build.dir}/@{pom.xml}">
        <filterset begintoken="@" endtoken="@">
          <filter token="maven_version" value="${maven_version}"/>
        </filterset>
      </copy>
      <artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-2"/>
      <artifact:pom id="maven.project" file="${maven.build.dir}/@{pom.xml}" />
      <artifact:deploy file="@{jar.file}" uniqueVersion="false">
        <artifact-attachments/>
        <remoteRepository url="${m2.repository.url}">
          <authentication username="${m2.repository.username}" privateKey="${m2.repository.private.key}"/>
        </remoteRepository>
        <pom refid="maven.project"/>
      </artifact:deploy>
    </sequential>
  </macrodef>

  <macrodef name="sign-artifact" description="Signs the artifact">
    <attribute name="input.file"/>
    <attribute name="output.file" default="@{input.file}.asc"/>
    <!--<attribute name="password.file" default="${user.home}/.pwd.txt"/>-->
    <sequential>
      <echo >Signing @{input.file} Sig File: @{output.file}</echo><!--Pass: @{password.file}-->

      <exec executable="gpg" > <!--input="@{password.file}"-->
        <arg value="--armor"/>
        <arg value="--output"/>
        <arg value="@{output.file}"/>
        <arg value="--detach-sig"/>
        <arg value="@{input.file}"/>
      </exec>
    </sequential>
  </macrodef>

  <!--
   We need to sign:
   The POM
   The library jar
   The sources jar
   the javadoc jar
   -->
  <macrodef name="sign-maven-artifacts" description="Signs maven artifacts">
    <attribute name="artifact.id"/>
    <attribute name="prefix.dir" default="${maven.dist.prefix}"/>
    <attribute name="maven.version" default="${maven_version}"/>
    <sequential>
      <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/@{maven.version}/@{artifact.id}-@{maven.version}.jar"/>
      <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/@{maven.version}/@{artifact.id}-@{maven.version}-javadoc.jar"/>
      <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/@{maven.version}/@{artifact.id}-@{maven.version}-sources.jar"/>
    </sequential>
  </macrodef>

  <macrodef name="sign-maven-dependency-artifacts" description="Signs maven artifacts">
    <attribute name="artifact.id"/>
    <attribute name="prefix.dir" default="${maven.dist.prefix}"/>
    <attribute name="maven.version" default="${maven_version}"/>
    <sequential>
      <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/@{maven.version}/@{artifact.id}-@{maven.version}.jar"/>
    </sequential>
  </macrodef>

  <!-- setup proxy for download tasks -->
  <condition property="proxy.specified">
    <or>
      <isset property="proxy.host"/>
      <isset property="proxy.port"/>
      <isset property="proxy.user"/>
    </or>
  </condition>

  <target name="proxy.setup" if="proxy.specified">
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.password}"/>
  </target>


  <target name="clean-contrib"
            description="Cleans all contrib modules and their tests">
  <contrib-crawl target="clean"/>
  </target>

  <target name="build-contrib"
          description="Builds all contrib modules and their tests">
    <contrib-crawl target="build"/>
  </target>

  <target name="test-contrib" depends="build-contrib">
    <contrib-crawl target="test" failonerror="true"/>
  </target>

  <target name="dist-contrib" description="Make the contribs ready for distribution">
    <contrib-crawl target="dist" failonerror="true" />
  </target>

  <target name="example-contrib" description="Tell the contrib to add their stuff to examples">
    <contrib-crawl target="example" failonerror="true" />
  </target>

  <!-- Creates a Manifest file for Jars and WARs -->
  <target name="make-manifest">
     <!-- If possible, include the svnversion -->
     <exec dir="." executable="${svnversion.exe}" outputproperty="svnversion" failifexecutionfails="false">
      <arg line="."/>
     </exec>

     <!-- no description, don't advertise -->
     <mkdir dir="${dest}/META-INF/" />
     <manifest mode="replace" file="${dest}/META-INF/MANIFEST.MF">
        <!--
        http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#JAR%20Manifest
        http://java.sun.com/j2se/1.5.0/docs/guide/versioning/spec/versioning2.html
        http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Package.html
        http://java.sun.com/j2se/1.5.0/docs/api/java/util/jar/package-summary.html
        http://java.sun.com/developer/Books/javaprogramming/JAR/basics/manifest.html
        -->
        <!-- Don't set 'Manifest-Version' it identifies the version of the
             manifest file format, and should always be 1.0 (the default)

             Don't set 'Created-by' attribute, its purpose is 
             to identify the version of java used to build the jar,
             which ant will do by default.

             Ant will happily override these with bogus strings if you
             tell it to, so don't.

             NOTE: we don't use section info because all of our manifest data
             applies to the entire jar/war ... no package specific info.
        -->
        <attribute name="Extension-Name" 
                   value="org.apache.solr"/>
        <attribute name="Specification-Title" 
                   value="Apache Solr Search Server"/>
        <!-- spec version must match "digit+{.digit+}*" -->
        <attribute name="Specification-Version" 
                   value="${specversion}"/>
        <attribute name="Specification-Vendor" 
                   value="The Apache Software Foundation"/>
        <attribute name="Implementation-Title" 
                   value="org.apache.solr"/>
        <!-- impl version can be any string -->
        <attribute name="Implementation-Version" 
                   value="${version} ${svnversion} - ${user.name} - ${DSTAMP} ${TSTAMP}"/>
        <attribute name="Implementation-Vendor" 
                   value="The Apache Software Foundation"/>
        <attribute name="X-Compile-Source-JDK" 
                   value="${java.compat.version}"/>
        <attribute name="X-Compile-Target-JDK" 
                   value="${java.compat.version}"/>
     </manifest>
  </target>

  <target name="maven.ant.tasks-check">
    <fail unless="maven.ant.tasks.present">
      ##################################################################
      Maven ant tasks not found.
      Please make sure the maven-ant-tasks jar is in ANT_HOME/lib, or made
      available to Ant using other mechanisms like -lib or CLASSPATH.
      ##################################################################
    </fail>
  </target>

</project>

 








Related examples in the same category

1.Ant script for xmlgraphics-commons
2.nutch ant script
3.rhino ant build script
4.Tomcat ant build script
5.OFBiz ant build script
6.Apache Lenya Build System
7.Apache pivot ant build script
8.XmlSchema ant script
9.xml security
10.velocity tools ant script
11.weka build script
12.xml bean ant script
13.xml graphics common ant script
14.uPortal ant script
15.SmartGWT ant script
16.Build file to fetch maven2 tasks; extracted from (Ant's) fetch.xml
17.Build file to fetch optional libraries for Apache Ant
18.Ant build script
19.Build script for apache-cassandra-0.5.1-src
20.apache-log4j-site\build.xml
21.apache-roller-src-4.0.1
22.Build script from apache dbutils
23.Fop build script
24.Google guice ant script
25.GWT ant script
26.hadoop ant build script
27.jakarta jmeter ant script
28.jakarta oro ant script
29.jakarta regexp ant script
30.jedit build script
31.jibx ant build script
32.lucene ant build script