Skip to content

Apache Lucene open-source search software

SOLR-2452: commit my state

Robert Muirdc58134cdc23
diff --git a/dev-tools/eclipse/dot.classpath b/dev-tools/eclipse/dot.classpath
index 987ea9ffcca..a5d64f92dcc 100644
--- a/dev-tools/eclipse/dot.classpath
+++ b/dev-tools/eclipse/dot.classpath
@@ -57,6 +57,7 @@
<classpathentry kind="src" path="solr/src/webapp/src"/>
<classpathentry kind="src" path="solr/src/common"/>
<classpathentry kind="src" path="solr/src/solrj"/>
+ <classpathentry kind="src" path="solr/src/test-framework"/>
<classpathentry kind="src" path="solr/src/test"/>
<classpathentry kind="src" path="solr/src/test-files"/>
<classpathentry kind="src" path="solr/contrib/analysis-extras/src/java"/>
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index 3225f7e0774..5d17436f1f8 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -515,8 +515,11 @@
<sysproperty key="tests.seed" value="${tests.seed}"/>
<!-- set the Version that tests should run against -->
<sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
- <!-- for lucene we can be strict, and we don't want false fails even across methods -->
+ <!-- for lucene we can be strict, and we don't want false fails even across methods
+ make this a param so lucene-core/contrib tests use it only?
<sysproperty key="tests.cleanthreads" value="perMethod"/>
+ -->
+ <sysproperty key="tests.cleanthreads" value="perClass"/>
<!-- logging config file -->
<sysproperty key="java.util.logging.config.file" value="${tests.loggingfile}"/>
<!-- set whether or not nightly tests should run -->
diff --git a/solr/build.xml b/solr/build.xml
index 5821f9953e6..82c1cd09094 100644
--- a/solr/build.xml
+++ b/solr/build.xml
@@ -17,36 +17,81 @@
limitations under the License.
-->
-<project name="solr" default="usage" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+<project name="solr-core" default="usage">
+ <description>Solr</description>
- <property name="solr-path" value="." />
-
- <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"/>
+ <property name="src.dir" location="src/java"/>
- <!-- Destination for distribution files (demo WAR, contrib JARs, etc.) -->
- <property name="dist" location="dist" />
+ <!-- solr uses this as the test working directory: nocommit classpath -->
+ <property name="tests.userdir" value="src/test-files"/>
- <property name="clover.db.dir" location="${dest}/tests/clover/db"/>
- <property name="clover.report.dir" location="${dest}/tests/clover/reports"/>
+ <path id="additional.dependencies">
+ <fileset dir="lib" includes="**/*.jar"/>
+ <fileset dir="example/lib" includes="**/*.jar"/>
+ </path>
- <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>
-
+ <import file="common-build.xml"/>
+
+ <!-- add some descriptions to some inherited targets -->
+ <target name="compile" description="Compile the source code."
+ depends="compile-core, build-contrib"/>
+ <target name="test" description="Run core and contrib unit tests."
+ depends="common.test, test-contrib"/>
+ <target name="test-core" description="Runs the core unit tests."
+ depends="common.test"/>
+ <target name="compile-test" description="Compile unit tests."
+ depends="compile-test-framework, common.compile-test"/>
+ <target name="javadocs" description="Generate javadocs for core, client, and contrib"
+ depends="contrib-build.javadocs, javadocs-solrj, javadocs-contrib"/>
+ <target name="javadocs-core" description="Generate javadocs for core."
+ depends="contrib-build.javadocs"/>
+
+ <!-- hackish we have to call init/clover here, but solr core depends upon solrj? -->
+ <target name="compile-core" depends="init, clover, compile-analyzers-common,
+ compile-analyzers-phonetic, compile-highlighter, compile-memory, compile-misc,
+ compile-queries, compile-spatial, compile-spellchecker, compile-solrj,
+ common.compile-core, compile-webapp"
+ unless="solr-core.compiled">
+ </target>
+
+ <target name="compile-webapp" depends="compile-solrj">
+ <compile srcdir="src/webapp/src"
+ destdir="${build.dir}/classes/webapp">
+ <classpath refid="classpath"/>
+ </compile>
+ </target>
+
+ <!-- TODO: factor solrj into a separate dir so its a normal module?
+ we have to reinvent wheels the way it is now -->
+
+ <target name="compile-solrj" description="Compile the java client.">
+ <compile srcdir="src/common:src/solrj"
+ destdir="${build.dir}/classes/solrj">
+ <classpath refid="classpath"/>
+ </compile>
+ </target>
+
+ <!-- hacky? -->
+ <target name="compile-test-framework" depends="compile-core">
+ <compile srcdir="src/test-framework" destdir="${build.dir}/classes/test-framework">
+ <classpath refid="test.classpath"/>
+ </compile>
+ </target>
+
+ <target name="javadocs-solrj" depends="compile-solrj" description="Generates solrj javadoc documentation.">
+ <sequential>
+ <mkdir dir="${javadoc.dir}/solrj"/>
+ <invoke-javadoc
+ destdir="${javadoc.dir}/solrj"
+ title="${Name}-j ${version} API (${specversion})">
+ <sources>
+ <packageset dir="src/common"/>
+ <packageset dir="src/solrj"/>
+ </sources>
+ </invoke-javadoc>
+ </sequential>
+ </target>
+
<!-- Default target: usage. Prints out instructions. -->
<target name="usage"
description="Prints out instructions">
@@ -64,1068 +109,45 @@
<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="${package.dir}" />
- <delete dir="example/solr/lib" />
- <delete dir="${lucene-libs}" />
+ <!-- TODO: lucene/solr could share these -->
+ <target name="build-contrib" depends="compile-test"
+ description="Builds all contrib modules and their tests">
+ <contrib-crawl target="build-artifacts-and-tests"/>
</target>
- <target name="clean-dest"
- description="Cleans out ${dest} but leaves ${dist} and ${package.dir} alone. This allows us to run nightly and clover together in Hudson">
- <delete includeemptydirs="true" >
- <fileset dir="${dest}">
- <exclude name="docs/"/>
- </fileset>
- </delete>
+ <target name="javadocs-contrib" description="Generate javadocs for contrib classes"
+ depends="build-contrib">
+ <contrib-crawl target="javadocs" failonerror="true"/>
</target>
- <!-- ========================================================================= -->
- <!-- ===================== COMPILATION-RELATED TASKS ========================= -->
- <!-- ========================================================================= -->
-
- <!-- The compilation classpath -->
- <path id="compile.classpath">
- <fileset dir="${lib}">
- <include name="*.jar" />
- </fileset>
- <path refid="lucene.classpath"/>
- </path>
-
- <target name="compile-solrj"
- description="Compile the java client."
- depends="compile-lucene">
-
- <solr-javac destdir="${dest}/solrj"
- classpathref="compile.classpath">
- <src path="${src}/common" />
- <src path="${src}/solrj" />
- </solr-javac>
+ <target name="test-contrib" description="Run contrib unit tests."
+ depends="build-contrib">
+ <contrib-crawl target="test" failonerror="true"/>
</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="validate-solr, compile-solrj">
-
- <solr-javac destdir="${dest}/solr"
- classpathref="compile.classpath.solrj">
- <src path="${src}/java" />
- <src path="${src}/webapp/src" />
- </solr-javac>
+ <target name="compile-analyzers-common" unless="analyzers-common.uptodate">
+ <ant dir="${common.dir}/../modules/analysis/common" target="default" inheritAll="false"/>
</target>
-
- <target name="javadoc-dep">
- <copy failonerror="false" todir="${build.docs}">
- <fileset dir="site" />
- </copy>
+ <target name="compile-analyzers-phonetic" unless="analyzers-phonetic.uptodate">
+ <ant dir="${common.dir}/../modules/analysis/phonetic" target="default" inheritAll="false"/>
</target>
-
- <target name="javadoc-solrj" depends="compile-solrj,javadoc-dep" 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 name="compile-highlighter" unless="highlighter.uptodate">
+ <ant dir="${common.dir}/contrib/highlighter" target="default" inheritAll="false"/>
</target>
-
- <target name="javadoc-core" depends="compile,javadoc-dep" 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 name="compile-memory" unless="memory.uptodate">
+ <ant dir="${common.dir}/contrib/memory" target="default" inheritAll="false"/>
</target>
-
-
- <target name="javadoc-all" depends="compile,javadoc-dep" 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"/>
- <include name="**/lucene-libs/**/*.jar"/>
- <exclude name="**/analysis-extras/lib/**/*icu4j*.jar"/> <!-- extraction/lib/ has this one -->
- </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/dataimporthandler/src/extras/main/java" />
- <packageset dir="contrib/clustering/src/main/java" />
- <packageset dir="contrib/extraction/src/main/java" />
- <packageset dir="contrib/uima/src/main/java" />
- <packageset dir="contrib/analysis-extras/src/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*" />
- <group title="contrib: Solr UIMA" packages="org.apache.solr.uima*" />
- </sources>
- </invoke-javadoc>
- </sequential>
- </target>
-
- <target name="javadoc-contrib" description="Generate javadoc for contrib classes" depends="build-contrib,javadoc-dep">
- <contrib-crawl target="javadoc"
- failonerror="true"/>
- </target>
-
- <target name="javadoc" depends="javadoc-core, javadoc-contrib, javadoc-solrj, javadoc-all">
- </target>
- <target name="javadocs" depends="javadoc"/>
-
- <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 -->
- <pathelement location="${common-solr.dir}/../lucene/build/classes/test-framework" /> <!-- include some lucene test code -->
- </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 location="${common-solr.dir}/../lucene/build/classes/test-framework" /> <!-- include some lucene test code -->
- <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>
- <!-- Copy any data files present to the classpath -->
- <copy todir="${dest}/tests">
- <fileset dir="${src}/test-files" excludes="**/*.java"/>
- </copy>
+ <target name="compile-misc" unless="misc.uptodate">
+ <ant dir="${common.dir}/contrib/misc" target="default" inheritAll="false"/>
</target>
-
- <!-- Run core unit tests. -->
- <target name="test-core"
- description="Runs the core unit tests."
- depends="compileTests, junit" />
-
- <!-- Run contrib unit tests. -->
- <target name="test"
- description="Runs the core unit tests."
- depends="test-core, test-contrib, test-jsp" />
-
- <target name="junit" depends="compileTests,junit-mkdir,junit-sequential,junit-parallel"/>
-
- <target name="junit-sequential" if="tests.sequential">
- <junit-macro/>
+ <target name="compile-queries" unless="queries.uptodate">
+ <ant dir="${common.dir}/contrib/queries" target="default" inheritAll="false"/>
</target>
-
- <target name="junit-parallel" unless="tests.sequential">
- <parallel threadsPerProcessor="${tests.threadspercpu}">
- <junit-macro threadNum="1" threadTotal="8"/>
- <junit-macro threadNum="2" threadTotal="8"/>
- <junit-macro threadNum="3" threadTotal="8"/>
- <junit-macro threadNum="4" threadTotal="8"/>
- <junit-macro threadNum="5" threadTotal="8"/>
- <junit-macro threadNum="6" threadTotal="8"/>
- <junit-macro threadNum="7" threadTotal="8"/>
- <junit-macro threadNum="8" threadTotal="8"/>
- </parallel>
+ <target name="compile-spatial" unless="spatial.uptodate">
+ <ant dir="${common.dir}/contrib/spatial" target="default" inheritAll="false"/>
</target>
-
- <target name="junit-mkdir">
- <mkdir dir="${junit.output.dir}"/>
- </target>
-
- <macrodef name="junit-macro">
- <attribute name="threadNum" default="1"/>
- <attribute name="threadTotal" default="1"/>
- <attribute name="tempDir" default="${junit.output.dir}/temp"/>
- <sequential>
- <!-- no description so it doesn't show up in -projecthelp -->
- <condition property="runall">
- <not>
- <or>
- <isset property="testcase"/>
- <isset property="testpackage"/>
- <isset property="testpackageroot"/>
- </or>
- </not>
- </condition>
- <!-- <mkdir dir="@{tempDir}/@{pattern}"/>
- This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
- -->
- <touch file="@{tempDir}/@{threadNum}/quiet.ant" verbose="false" mkdirs="true"/>
- <property name="dir.prop" value=""/>
- <junit printsummary="no"
- haltonfailure="no"
- maxmemory="512M"
- errorProperty="tests.failed"
- failureProperty="tests.failed"
- dir="@{tempDir}/@{threadNum}"
- tempdir="@{tempDir}/@{threadNum}"
- forkmode="perBatch"
- >
- <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>
- <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
- <sysproperty key="tests.codec" value="${tests.codec}"/>
- <sysproperty key="tests.locale" value="${tests.locale}"/>
- <sysproperty key="tests.timezone" value="${tests.timezone}"/>
- <sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
- <sysproperty key="tests.iter" value="${tests.iter}"/>
- <sysproperty key="tests.seed" value="${tests.seed}"/>
- <sysproperty key="tests.verbose" value="${tests.verbose}"/>
- <sysproperty key="jetty.testMode" value="1"/>
- <sysproperty key="tempDir" file="@{tempDir}/@{threadNum}"/>
- <sysproperty key="testmethod" value="${testmethod}"/>
- <!-- set whether or not nightly tests should run -->
- <sysproperty key="tests.nightly" value="${tests.nightly}"/>
- <!-- TODO: why is this unconditionally set to "" above? disable for now
- <jvmarg line="${dir.prop}"/>
- -->
- <jvmarg line="${args}"/>
-
- <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
- <classpath refid="test.run.classpath"/>
- <assertions>
- <enable package="org.apache.lucene"/>
- <enable package="org.apache.solr"/>
- </assertions>
- <formatter type="${junit.formatter}"/>
- <batchtest fork="yes" todir="${junit.output.dir}" if="runall">
- <fileset dir="src/test" includes="**/Test*.java,**/*Test.java">
- <custom classname="${junit.parallel.selector}" classpathref="test.run.classpath">
- <param name="divisor" value="@{threadTotal}" />
- <param name="part" value="@{threadNum}" />
- </custom>
- </fileset>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testpackage">
- <fileset dir="src/test" includes="**/${testpackage}/**/Test*.java,**/${testpackage}/**/*Test.java">
- <custom classname="${junit.parallel.selector}" classpathref="test.run.classpath">
- <param name="divisor" value="@{threadTotal}" />
- <param name="part" value="@{threadNum}" />
- </custom>
- </fileset>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testpackageroot">
- <fileset dir="src/test" includes="**/${testpackageroot}/Test*.java,**/${testpackageroot}/*Test.java">
- <custom classname="${junit.parallel.selector}" classpathref="test.run.classpath">
- <param name="divisor" value="@{threadTotal}" />
- <param name="part" value="@{threadNum}" />
- </custom>
- </fileset>
- </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>
- </sequential>
- </macrodef>
-
-
- <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="cloverlib.xml"/>
- <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" />
- <fileset dir="contrib/uima/src/main/java" />
- <fileset dir="contrib/analysis-extras/src/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>
-
- <!-- ========================================================================= -->
-
- <!-- Checks that all JSP files in the webapp compile successfully using Jetty's Jasper -->
- <target name="test-jsp" depends="compile">
- <property name="jsp.target" location="${dest}/jsp-temp" />
- <taskdef classname="org.apache.jasper.JspC" name="jasper" >
- <classpath>
- <fileset dir="example/lib" includes="**/*.jar" />
- </classpath>
- </taskdef>
- <delete dir="${jsp.target}" />
- <mkdir dir="${jsp.target}" />
- <jasper
- uriroot="${src}/webapp/web"
- outputDir="${jsp.target}"
- compile="false"
- verbose="1"
- package="j"
- />
- <javac
- srcdir="${jsp.target}"
- destdir="${jsp.target}"
- target="${java.compat.version}"
- source="${java.compat.version}"
- debug="off"
- encoding="utf8"
- includeAntRuntime="${javac.includeAntRuntime}"
- classpathref="test.compile.classpath"
- />
- </target>
-
-
- <!-- ========================================================================= -->
- <!-- ===================== DISTRIBUTION-RELATED TASKS ======================== -->
- <!-- ========================================================================= -->
-
-
- <!-- Creates the Solr distribution files. -->
- <target name="dist"
- description="Creates the Solr distribution files."
- depends="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, test-jsp, make-manifest, dist-jar, dist-solrj, lucene-jars-to-solr">
- <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="${lucene-libs}"/>
-
- <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 for maven"
- 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-clustering-src-${version}.jar"
- basedir="contrib/clustering/src" />
- <solr-jar destfile="${dist}/apache-solr-analysis-extras-src-${version}.jar"
- basedir="contrib/analysis-extras/src" />
- <solr-jar destfile="${dist}/apache-solr-uima-src-${version}.jar"
- basedir="contrib/uima/src/main/java" >
- <fileset dir="contrib/uima/src/main/resources" />
- </solr-jar>
- </target>
-
- <target name="dist-javadoc" description="Creates the Solr javadoc distribution files for maven"
- 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-cell-docs-${version}.jar"
- basedir="${build.javadoc}/contrib-solr-cell" />
- <solr-jar destfile="${dist}/apache-solr-analysis-extras-docs-${version}.jar"
- basedir="${build.javadoc}/contrib-solr-analysis-extras" />
- <solr-jar destfile="${dist}/apache-solr-uima-docs-${version}.jar"
- basedir="${build.javadoc}/contrib-solr-uima" />
- </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="compile-lucene,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"
- description="Run Solr interactively, via Jetty. -Dexample.debug=true to enable JVM debugger">
- <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="package-src,create-package"/>
-
- <property name="svn.export.dir" location="${dest}/svn-export"/>
-
- <!-- Makes a tarball from running "svn export" at the root level. -->
- <!-- Copies NOTICE.txt and LICENSE.txt from solr/ to the root level. -->
- <target name="package-src" depends="svn-export-source"
- description="Packages the Solr Source Distribution">
- <mkdir dir="${package.dir}"/>
- <property name="source.package.file"
- value="${package.dir}/${fullnamever}-src.tgz"/>
- <delete file="${source.package.file}" failonerror="false" />
- <tar destfile="${source.package.file}" compression="gzip" longfile="gnu">
- <tarfileset dir="${svn.export.dir}" prefix="${fullnamever}"/>
- <tarfileset dir="${svn.export.dir}/solr" prefix="${fullnamever}"
- includes="NOTICE.txt,LICENSE.txt"/>
- </tar>
- <solr-checksum file="${source.package.file}"/>
- </target>
-
- <!-- Runs "svn export" in build/svn-export/ with the same root-level URL -->
- <!-- and revision as the current working copy. -->
- <target name="svn-export-source" depends="get-svn-info">
- <delete dir="${svn.export.dir}" includeemptydirs="true" failonerror="false"/>
- <mkdir dir="${dest}"/>
- <exec dir="." executable="${svn.exe}" failonerror="true">
- <arg value="export"/>
- <arg value="--native-eol"/>
- <arg value="LF"/>
- <arg value="-r"/>
- <arg value="${svn.Revision}"/>
- <arg value="${svn.URL}"/>
- <arg value="${svn.export.dir}"/>
- </exec>
- </target>
-
- <!-- Populates properties svn.URL and svn.Revision using "svn info" -->
- <target name="get-svn-info">
- <exec dir=".." executable="${svn.exe}" outputproperty="svn.info" failonerror="true">
- <arg value="info"/>
- </exec>
- <loadproperties>
- <propertyresource name="svn.info"/>
- <filterchain>
- <linecontainsregexp>
- <regexp pattern="(URL|Revision):"/>
- </linecontainsregexp>
- <replacestring from=": " to="="/>
- <prefixlines prefix="svn."/>
- </filterchain>
- </loadproperties>
- </target>
-
- <target name="create-package"
- description="Packages the Solr Binary Distribution"
- depends="dist, example, javadoc">
- <mkdir dir="${package.dir}"/>
-
- <delete includeemptydirs="true">
- <fileset dir="${example}/work" includes="**/*"/>
- </delete>
-
- <delete includeemptydirs="true" failonerror="false">
- <fileset dir="${dest}/${fullnamever}" includes="**/*"/>
- </delete>
-
- <delete file="${package.dir}/${fullnamever}.tgz" failonerror="false" />
- <delete file="${package.dir}/${fullnamever}.zip" failonerror="false" />
-
- <tar destfile="${package.dir}/${fullnamever}.tgz" compression="gzip" longfile="gnu">
- <tarfileset dir="."
- prefix="${fullnamever}"
- includes="LICENSE.txt NOTICE.txt *.txt example/** client/** contrib/**/lib/ contrib/**/lucene-libs/ contrib/**/README.txt contrib/**/CHANGES.txt"
- excludes="${dist}/** ${dest}/** lib/README.committers.txt **/data/ **/logs/* **/classes/ **/*.sh **/bin/ src/scripts/** src/site/build/** **/target/** client/ruby/flare/** client/python/** client/javascript/** contrib/**/build/** **/*.iml **/*.ipr **/*.iws **/*pom.xml.template" />
- <tarfileset dir="."
- mode="755"
- prefix="${fullnamever}"
- includes="example/**/*.sh example/**/bin/" />
- <tarfileset dir="."
- prefix="${fullnamever}"
- includes="dist/*.jar dist/*.war dist/solrj-lib/*"
- excludes="**/*.tgz **/*.zip **/*.md5 **/*src*.jar **/*docs*.jar" />
- <!-- hack: the javadocs are built twice since maven needs separate packages... exclude those -->
- <tarfileset dir="${build.docs}"
- prefix="${fullnamever}/docs/"
- excludes="api/solr/** api/contrib-*/**"
- />
- </tar>
- <solr-checksum file="${package.dir}/${fullnamever}.tgz"/>
-
- <gunzip src="${package.dir}/${fullnamever}.tgz" dest="${dest}/${fullnamever}.tar"/>
- <untar src="${dest}/${fullnamever}.tar" dest="${dest}"/>
-
- <!--
- This is a list of text file patterns to convert to CRLF line-ending style.
- Shell scripts and files included in shell scripts should not be converted.
- NB: The line-ending conversion process will mangle non-UTF8-encoded files.
- -->
- <fixcrlf srcdir="${dest}/${fullnamever}"
- encoding="UTF-8"
- eol="crlf"
- includes="**/*.alg **/*.cfg **/*.cgi **/*.cpp **/*.css **/*.csv **/*.dtd
- **/*.erb **/*.fcgi **/.htaccess **/*.htm **/*.html **/*.incl
- **/*.java **/*.javacc **/*.jflex **/*.jflex-macro **/*.jj
- **/*.js **/*.json **/*.jsp **/*LICENSE **/package-list **/*.pl
- **/*.pom **/*pom.xml.template **/*.properties **/*.py
- **/*.rake **/Rakefile **/*.rb **/*.rbbi **/README* **/*.rhtml
- **/*.rslp **/*.rxml **/*.script **/*.svg **/*.tsv **/*.txt
- **/UPGRADING **/USAGE **/*.uxf **/*.vm **/*.xcat **/*.xml
- **/*.xsl **/*.xslt **/*.yml"
- excludes="**/stopwordsWrongEncoding.txt **/gb18030-example.xml"
- />
-
- <zip destfile="${package.dir}/${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="${package.dir}/${fullnamever}.zip"/>
-
- </target>
-
-
- <target name="build-site" depends="svn-up"
- 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>
- <antcall target="svn-up"/>
-
- </target>
- <target name="svn-up">
- <exec executable="${svn.exe}">
- <arg value="update"/>
- </exec>
- </target>
-
- <target name="clean-package-signatures">
- <delete failonerror="false">
- <fileset dir="${package.dir}">
- <include name="**/*.asc"/>
- </fileset>
- </delete>
- </target>
- <target name="sign-artifacts" depends="clean-package-signatures">
- <!--<property file="${user.home}/.solr/build.properties" />-->
- <input message="password:>" addproperty="gpg.passphrase">
- <handler classname="org.apache.tools.ant.input.SecureInputHandler" />
- </input>
- <sign-artifact input.file="${package.dir}/${fullnamever}.tgz" output.file="${package.dir}/${fullnamever}.tgz.asc" gpg.passphrase="${gpg.passphrase}"/>
- <sign-artifact input.file="${package.dir}/${fullnamever}.zip" output.file="${package.dir}/${fullnamever}.zip.asc" gpg.passphrase="${gpg.passphrase}"/>
- <sign-artifact input.file="${package.dir}/${fullnamever}-src.tgz" output.file="${package.dir}/${fullnamever}-src.tgz.asc" gpg.passphrase="${gpg.passphrase}"/>
-
- <!-- Maven artifacts -->
- <sign-maven-dependency-artifacts artifact.id="solr-commons-csv" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-dependency-artifacts artifact.id="solr-noggit" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-dependency-artifacts artifact.id="solr-uima-an-alchemy" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-dependency-artifacts artifact.id="solr-uima-an-calais" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-dependency-artifacts artifact.id="solr-uima-an-tagger" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-dependency-artifacts artifact.id="solr-uima-an-wst" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-war-artifacts artifact.id="solr" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-artifacts artifact.id="solr-analysis-extras" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-artifacts artifact.id="solr-cell" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-artifacts artifact.id="solr-clustering" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-artifacts artifact.id="solr-core" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-artifacts artifact.id="solr-dataimporthandler" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-artifacts artifact.id="solr-dataimporthandler-extras" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-artifacts artifact.id="solr-solrj" gpg.passphrase="${gpg.passphrase}"/>
- <sign-maven-artifacts artifact.id="solr-uima" gpg.passphrase="${gpg.passphrase}"/>
-
- <!-- These are special since there are no jars, just poms -->
- <sign-artifact input.file="${maven.dist.prefix}/solr-parent/${version}/solr-parent-${version}.pom" gpg.passphrase="${gpg.passphrase}"/>
- </target>
-
- <property name="rc" value="rc0"/>
- <property name="remote.staging.dir" value="public_html/staging_area/${rc}/${version}"/>
- <property name="keyfile" value="${user.home}/.ssh/id_rsa"/>
- <property name="scp.user" value="${user.name}"/>
- <!--keys.dir is the location of the https://svn.apache.org/repos/asf/lucene/java/dist/ directory-->
- <property name="keys.dir" value="${common-solr.dir}/../../dist"/>
- <target name="copy-to-stage">
- <sshexec host="people.apache.org"
- username="${scp.user}"
- keyfile="${keyfile}"
- command="mkdir -p ${remote.staging.dir}"/>
- <echo>Uploading artifacts to ${scp.user}@people.apache.org:${remote.staging.dir}</echo>
- <scp todir="${scp.user}@people.apache.org:${remote.staging.dir}"
- username="${scp.user}"
- keyfile="${keyfile}"
- verbose="true"
- >
- <fileset dir="package"/>
- <fileset dir="${keys.dir}">
- <include name="KEYS"/>
- </fileset>
- </scp>
- </target>
-
- <target name="prepare-release" depends="clean, svn-up, package, generate-maven-artifacts, sign-artifacts"
- description="Prototype helper for Committers. Assumes gpg is in the path"/>
-
- <target name="stage" depends="prepare-release, copy-to-stage"/>
-
- <target name="generate-maven-artifacts" depends="maven.ant.tasks-check,dist,dist-src,dist-javadoc">
- <sequential>
- <ant target="get-maven-poms" dir=".."/>
-
- <!--
-
- !!!!!!!!!!
- 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="pom.xml"/>
-
- <!-- ========== SOLR SPECIFIC NON-MAVENIZED DEPENDENCIES ========== -->
- <m2-deploy-with-pom-template pom.xml="lib/solr-commons-csv-pom.xml.template"
- jar.file="lib/commons-csv-1.0-SNAPSHOT-r966014.jar" />
-
- <m2-deploy-with-pom-template pom.xml="lib/apache-solr-noggit-pom.xml.template"
- jar.file="lib/apache-solr-noggit-r944541.jar" />
-
- <m2-deploy-with-pom-template pom.xml="contrib/uima/lib/solr-uima-an-alchemy-pom.xml.template"
- jar.file="contrib/uima/lib/uima-an-alchemy-2.3.1-SNAPSHOT-r1062868.jar" />
-
- <m2-deploy-with-pom-template pom.xml="contrib/uima/lib/solr-uima-an-calais-pom.xml.template"
- jar.file="contrib/uima/lib/uima-an-calais-2.3.1-SNAPSHOT-r1062868.jar" />
-
- <m2-deploy-with-pom-template pom.xml="contrib/uima/lib/solr-uima-an-tagger-pom.xml.template"
- jar.file="contrib/uima/lib/uima-an-tagger-2.3.1-SNAPSHOT-r1062868.jar" />
-
- <m2-deploy-with-pom-template pom.xml="contrib/uima/lib/solr-uima-an-wst-pom.xml.template"
- jar.file="contrib/uima/lib/uima-an-wst-2.3.1-SNAPSHOT-r1076132.jar" />
-
- <!-- ========== SOLR ARTIFACTS ========== -->
-
- <m2-deploy pom.xml="contrib/dataimporthandler/src/pom.xml"
- 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/src/extras/pom.xml"
- 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/pom.xml"
- 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/pom.xml"
- 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>
-
- <m2-deploy pom.xml="contrib/analysis-extras/pom.xml"
- jar.file="${dist}/apache-solr-analysis-extras-${version}.jar">
- <artifact-attachments>
- <attach file="${dist}/apache-solr-analysis-extras-src-${version}.jar" classifier="sources"/>
- <attach file="${dist}/apache-solr-analysis-extras-docs-${version}.jar" classifier="javadoc"/>
- </artifact-attachments>
- </m2-deploy>
-
- <m2-deploy pom.xml="contrib/uima/pom.xml"
- jar.file="${dist}/apache-solr-uima-${version}.jar">
- <artifact-attachments>
- <attach file="${dist}/apache-solr-uima-src-${version}.jar" classifier="sources"/>
- <attach file="${dist}/apache-solr-uima-docs-${version}.jar" classifier="javadoc"/>
- </artifact-attachments>
- </m2-deploy>
-
- <m2-deploy pom.xml="src/pom.xml"
- 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/solrj/pom.xml"
- 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>
-
- <m2-deploy pom.xml="src/webapp/pom.xml"
- jar.file="${dist}/apache-solr-${version}.war"/>
- </sequential>
- </target>
-
- <target name="set-fsdir">
- <property name="use.fsdir" value="true"/>
- </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/test"/>
- <fileset dir="src/webapp"/>
- <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/dataimporthandler/src/extras/main/java"/>
- <fileset dir="contrib/dataimporthandler/src/extras/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"/>
- <fileset dir="contrib/analysis-extras/src/test"/>
- <fileset dir="contrib/analysis-extras/src/test"/>
- <fileset dir="contrib/uima/src/main/java"/>
- <fileset dir="contrib/uima/src/test/java"/>
- </rat:report>
- </target>
-
-
- <!-- ========================================================================= -->
- <!-- ===================== Runtime: luke ============================= -->
- <!-- ========================================================================= -->
- <property name="luke.version" value="1.0.1"/>
- <available file="luke/luke-${luke.version}.jar" property="luke.jar.exists" />
- <target name="luke-download" unless="luke.jar.exists" depends="proxy.setup">
- <mkdir dir="luke"/>
- <get src="http://luke.googlecode.com/files/luke-${luke.version}.jar"
- dest="luke/luke-${luke.version}.jar"/>
- </target>
- <path id="luke.classpath">
- <pathelement location="${common-solr.dir}/../lucene/build/classes/java" />
- <pathelement location="${common-solr.dir}/../lucene/build/contrib/xml-query-parser/classes/java" />
-
- </path>
- <target name="luke" depends="luke-download">
- <java fork="true"
- classname="org.getopt.luke.Luke"
- logError="true"
- failonerror="true">
- <classpath>
- <fileset dir="luke">
- <include name="luke-${luke.version}.jar"/>
- </fileset>
- <path refid="lucene.classpath"/>
- <path refid="luke.classpath"/>
- <path refid="test.run.classpath"/>
- </classpath>
- </java>
+ <target name="compile-spellchecker" unless="spellchecker.uptodate">
+ <ant dir="${common.dir}/contrib/spellchecker" target="default" inheritAll="false"/>
</target>
</project>
-
-
diff --git a/solr/common-build.xml b/solr/common-build.xml
index 861ff237062..32006ba1470 100644
--- a/solr/common-build.xml
+++ b/solr/common-build.xml
@@ -15,624 +15,106 @@
limitations under the License.
-->
-<project name="common-solr" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+<project name="common-solr" default="default">
<description>
This file is designed for importing into a main build file, and not intended
for standalone use.
</description>
<dirname file="${ant.file.common-solr}" property="common-solr.dir"/>
- <import file="${common-solr.dir}/../common-build.xml"/>
- <!-- change this together with the default and test's solrconfig.xml after starting a new development branch: -->
- <property name="tests.luceneMatchVersion" value="4.0"/>
-
- <!-- Initialize property values: allow easy customization via build.properties -->
- <property file="build.properties" />
-
<property name="Name" value="Solr" />
+ <property name="version" value="4.0-SNAPSHOT"/>
+ <property name="final.name" value="apache-${name}-${version}"/>
- <property name="name" value="${ant.project.name}"/>
+ <!-- solr uses 1.6 -->
+ <property name="javac.source" value="1.6"/>
+ <property name="javac.target" value="1.6"/>
- <property name="dev-tools.dir" value="${solr-path}/../dev-tools"/>
- <property name="prettify.dir" value="${solr-path}/../lucene/src/tools/prettify"/>
- <property name="package.dir" location="package"/>
+ <!-- solr uses its own build/dist directories -->
+ <property name="build.dir" location="${common-solr.dir}/build"/>
+ <property name="dist.dir" location="${common-solr.dir}/dist"/>
+ <property name="tests.userdir" value="${common-solr.dir}/src/test-files"/>
+ <property name="javadoc.dir" location="${common-solr.dir}/build/docs/api"/>
+ <property name="javadoc.link" value="http://java.sun.com/javase/6/docs/api/"/>
- <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>
+ <path id="additional.dependencies">
+ <fileset dir="${common-solr.dir}/lib" includes="**/*.jar"/>
+ <fileset dir="${common-solr.dir}/example/lib" includes="**/*.jar"/>
+ <fileset dir="lib" includes="**/*.jar" erroronmissingdir="false"/>
+ </path>
- <property name="junit.details" value="1"/>
+ <pathconvert property="project.classpath" targetos="unix" refid="additional.dependencies"/>
- <!-- default arguments to pass to jvm executing tests -->
- <property name="args" value="" />
+ <property name="tests.loggingfile" value="${common-solr.dir}/testlogging.properties"/>
- <!-- TODO: measure toning this down by default to 1 -->
<property name="tests.threadspercpu" value="2"/>
- <condition property="tests.sequential">
- <or>
- <isset property="testcase"/>
- <equals arg1="${tests.threadspercpu}" arg2="0"/>
- </or>
- </condition>
-
- <property name="tests.multiplier" value="1" />
- <property name="tests.codec" value="randomPerField" />
- <property name="tests.locale" value="random" />
- <property name="tests.timezone" value="random" />
- <property name="tests.iter" value="1" />
- <property name="tests.seed" value="random" />
- <property name="tests.nightly" value="false" />
- <property name="tests.verbose" value="false" />
-
- <condition property="dir.prop" value="-Dsolr.directoryFactory=solr.StandardDirectoryFactory">
- <isset property="use.fsdir"/>
- </condition>
-
- <!-- Example directory -->
- <property name="example" value="${common-solr.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" />
- <property name="svn.exe" value="svn" />
-
- <!-- Java Version we are compatible with -->
- <property name="java.compat.version" value="1.6" />
-
- <!-- clover wants to run with -lib, otherwise we prefer a repeatable
- classpath -->
- <property name="javac.includeAntRuntime" value="${run.clover}"/>
-
- <!-- 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-SNAPSHOT" where X.Y.N is
- "1 greater" then the last version released (on this branch).
- -->
- <property name="version" value="4.0-SNAPSHOT" />
-
- <!-- 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="4.0.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" />
-
- <!-- Destination for Lucene jars -->
- <property name="lucene-libs" location="lucene-libs" />
-
- <!-- 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/javase/6/docs/api/"/>
- <property name="javadoc.link.junit"
- value="http://junit.sourceforge.net/javadoc/"/>
- <property name="javadoc.link.lucene"
- value="https://hudson.apache.org/hudson/job/Lucene-trunk/javadoc/all/"/>
- <property name="javadoc.packages" value="org.apache.solr.*"/>
- <property name="build.docs" value="${dest}/docs"/>
- <property name="build.javadoc" value="${common-solr.dir}/${build.docs}/api"/>
- <property name="build.javadoc.solrj" value="${build.docs}/api-solrj"/>
-
- <!-- JUnit properties -->
- <property name="testmethod" value=""/>
- <property name="junit.includes" value="**/Test*.java,**/*Test.java"/>
- <property name="junit.output.dir" location="${common-solr.dir}/${dest}/test-results"/>
- <property name="junit.reports" location="${common-solr.dir}/${dest}/test-results/reports"/>
- <property name="junit.formatter" value="plain"/>
- <condition property="junit.details.formatter"
- value="org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"
- else="org.apache.lucene.util.LuceneJUnitResultFormatter">
- <isset property="tests.sequential"/>
- </condition>
- <property name="junit.parallel.selector" value="org.apache.lucene.util.LuceneJUnitDividingSelector"/>
-
- <!-- Maven properties -->
- <property name="maven.build.dir" value="${basedir}/build/maven"/>
- <property name="maven.dist.dir" value="${package.dir}/maven"/>
-
- <property name="maven.dist.prefix" value="${maven.dist.dir}/org/apache/solr"/>
-
- <!-- 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>
-
- <!-- Lucene -->
-
- <path id="lucene.classpath">
- <pathelement location="${common-solr.dir}/../lucene/build/classes/java" />
- <pathelement location="${common-solr.dir}/../modules/analysis/build/common/classes/java" />
- <pathelement location="${common-solr.dir}/../modules/analysis/build/phonetic/classes/java" />
- <pathelement location="${common-solr.dir}/../lucene/build/contrib/highlighter/classes/java" />
- <pathelement location="${common-solr.dir}/../lucene/build/contrib/memory/classes/java" />
- <pathelement location="${common-solr.dir}/../lucene/build/contrib/misc/classes/java" />
- <pathelement location="${common-solr.dir}/../lucene/build/contrib/queries/classes/java" />
- <pathelement location="${common-solr.dir}/../lucene/build/contrib/spatial/classes/java" />
- <pathelement location="${common-solr.dir}/../lucene/build/contrib/spellchecker/classes/java" />
- </path>
-
- <target name="prep-lucene-jars">
- <sequential>
- <subant target="jar-core" inheritall="false" failonerror="true">
- <fileset dir="../lucene/" includes="build.xml" />
- </subant>
- <subant target="jar" inheritall="false" failonerror="true">
- <fileset dir="../modules/analysis/common" includes="build.xml" />
- <fileset dir="../modules/analysis/phonetic" includes="build.xml" />
- <fileset dir="../lucene/contrib/highlighter" includes="build.xml" />
- <fileset dir="../lucene/contrib/memory" includes="build.xml" />
- <fileset dir="../lucene/contrib/misc" includes="build.xml" />
- <fileset dir="../lucene/contrib/queries" includes="build.xml" />
- <fileset dir="../lucene/contrib/spatial" includes="build.xml" />
- <fileset dir="../lucene/contrib/spellchecker" includes="build.xml" />
- </subant>
- </sequential>
- </target>
-
- <target name="lucene-jars-to-solr" depends="prep-lucene-jars">
- <mkdir dir="${lucene-libs}"/>
- <copy todir="${lucene-libs}" preservelastmodified="true" flatten="true" failonerror="true" overwrite="true">
- <fileset dir="../lucene/build/">
- <include name="lucene-core-${version}.jar" />
- </fileset>
- <fileset dir="../modules/analysis/build/common">
- <include name="lucene-analyzers-common-${version}.jar" />
- </fileset>
- <fileset dir="../modules/analysis/build/phonetic">
- <include name="lucene-analyzers-phonetic-${version}.jar" />
- </fileset>
- <fileset dir="../lucene/build/contrib/highlighter">
- <include name="lucene-highlighter-${version}.jar" />
- </fileset>
- <fileset dir="../lucene/build/contrib/memory">
- <include name="lucene-memory-${version}.jar" />
- </fileset>
- <fileset dir="../lucene/build/contrib/misc">
- <include name="lucene-misc-${version}.jar" />
- </fileset>
- <fileset dir="../lucene/build/contrib/queries">
- <include name="lucene-queries-${version}.jar" />
- </fileset>
- <fileset dir="../lucene/build/contrib/spatial">
- <include name="lucene-spatial-${version}.jar" />
- </fileset>
- <fileset dir="../lucene/build/contrib/spellchecker">
- <include name="lucene-spellchecker-${version}.jar" />
- </fileset>
- </copy>
- </target>
-
- <target name="compile-lucene" unless="lucene-compiled">
- <property name="lucene-compiled" value="true"/>
- <subant target="default">
- <fileset dir="../modules/analysis/common" includes="build.xml"/>
- <fileset dir="../modules/analysis/phonetic" includes="build.xml"/>
- <fileset dir="../lucene/contrib/highlighter" includes="build.xml"/>
- <fileset dir="../lucene/contrib/memory" includes="build.xml"/>
- <fileset dir="../lucene/contrib/misc" includes="build.xml"/>
- <fileset dir="../lucene/contrib/queries" includes="build.xml"/>
- <fileset dir="../lucene/contrib/spatial" includes="build.xml"/>
- <fileset dir="../lucene/contrib/spellchecker" includes="build.xml"/>
- </subant>
- </target>
-
-
- <!-- 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"
- includeAntRuntime="${javac.includeAntRuntime}"
- sourcepath=""
- classpathref="@{classpathref}">
- <compilerarg line="-Xlint -Xlint:-deprecation -Xlint:-serial"/>
- <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-solr.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-solr.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"/>
- <sequential>
- <echo>Building checksums for '@{file}'</echo>
- <checksum file="@{file}" algorithm="md5" format="MD5SUM" forceoverwrite="yes" readbuffersize="65536"/>
- <checksum file="@{file}" algorithm="sha1" format="MD5SUM" forceoverwrite="yes" readbuffersize="65536"/>
- </sequential>
- </macrodef>
-
+ <import file="../lucene/contrib/contrib-build.xml"/>
+
+ <!-- solr depends on the following modules/contribs -->
+ <module-uptodate name="analysis/common" jarfile="${common.dir}/../modules/analysis/build/common/lucene-analyzers-common-${version}.jar"
+ property="analyzers-common.uptodate" classpath.property="analyzers-common.jar"/>
+ <module-uptodate name="analysis/phonetic" jarfile="${common.dir}/../modules/analysis/build/phonetic/lucene-analyzers-phonetic-${version}.jar"
+ property="analyzers-phonetic.uptodate" classpath.property="analyzers-phonetic.jar"/>
+ <contrib-uptodate name="highlighter" property="highlighter.uptodate" classpath.property="highlighter.jar"/>
+ <contrib-uptodate name="memory" property="memory.uptodate" classpath.property="memory.jar"/>
+ <contrib-uptodate name="misc" property="misc.uptodate" classpath.property="misc.jar"/>
+ <contrib-uptodate name="queries" property="queries.uptodate" classpath.property="queries.jar"/>
+ <contrib-uptodate name="spatial" property="spatial.uptodate" classpath.property="spatial.jar"/>
+ <contrib-uptodate name="spellchecker" property="spellchecker.uptodate" classpath.property="spellchecker.jar"/>
+
+ <path id="solr.base.classpath">
+ <pathelement path="${analyzers-common.jar}"/>
+ <pathelement path="${analyzers-phonetic.jar}"/>
+ <pathelement path="${highlighter.jar}"/>
+ <pathelement path="${memory.jar}"/>
+ <pathelement path="${misc.jar}"/>
+ <pathelement path="${queries.jar}"/>
+ <pathelement path="${spatial.jar}"/>
+ <pathelement path="${spellchecker.jar}"/>
+ <pathelement location="${common-solr.dir}/build/classes/solrj"/>
+ <pathelement location="${common-solr.dir}/build/classes/webapp"/>
+ <pathelement location="${common-solr.dir}/build/classes/java"/>
+ <path refid="base.classpath"/>
+ </path>
+
+ <path id="classpath" refid="solr.base.classpath"/>
+
+ <path id="solr.test.base.classpath">
+ <pathelement path="${common-solr.dir}/build/classes/test-framework"/>
+ <pathelement path="${common-solr.dir}/build/classes/test"/>
+ <pathelement path="${tests.userdir}"/>
+ <path refid="test.base.classpath"/>
+ </path>
+
+ <path id="test.classpath" refid="solr.test.base.classpath"/>
+
+ <!-- TODO: lucene and solr should share this macro -->
<macrodef name="contrib-crawl">
<attribute name="target" default=""/>
<attribute name="failonerror" default="true"/>
<sequential>
<subant target="@{target}" failonerror="@{failonerror}">
- <property name="lucene-compiled" value="${lucene-compiled}"/>
- <fileset dir="."
- includes="contrib/*/build.xml"
- />
+ <property name="core.compiled" value="true"/>
+ <property name="solr.core.compiled" value="true"/>
+ <fileset dir="." includes="contrib/*/build.xml"/>
</subant>
</sequential>
</macrodef>
- <property name="failonjavadocwarning" value="true"/>
- <macrodef name="invoke-javadoc">
- <element name="sources" optional="yes"/>
- <attribute name="destdir"/>
- <attribute name="title" default="${Name} ${version} API (${specversion})"/>
- <sequential>
- <mkdir dir="@{destdir}"/>
- <copy todir="@{destdir}/prettify" overwrite="false">
- <fileset dir="${prettify.dir}"/>
- </copy>
- <record name="@{destdir}/log_javadoc.txt" action="start" append="no"/>
- <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}"
- stylesheetfile="@{destdir}/prettify/stylesheet+prettify.css"
- bottom="Copyright &amp;copy; ${year} Apache Software Foundation. All Rights Reserved.">
- <tag name="todo" description="To Do:"/>
- <tag name="uml.property" description="UML Property:"/>
- <tag name="lucene.experimental"
- description="WARNING: This API is experimental and might change in incompatible ways in the next release."/>
- <tag name="lucene.internal"
- description="NOTE: This API is for Lucene internal purposes only and might change in incompatible ways in the next release."/>
- <link offline="true" packagelistLoc="${build.javadoc}"/>
- <link href="${javadoc.link.java}"/>
- <link href="${javadoc.link.junit}"/>
- <link href="${javadoc.link.lucene}"/>
- <header><![CDATA[
- <script src="{@docRoot}/prettify/prettify.js" type="text/javascript"></script>
- <script language="JavaScript">window.onload=function(){windowTitle();prettyPrint();}</script>
- ]]></header>
-
- <sources />
-
- <classpath refid="javadoc.classpath"/>
- </javadoc>
- <record name="@{destdir}/log_javadoc.txt" action="stop"/>
-
- <delete>
- <fileset file="@{destdir}/log_javadoc.txt">
- <not>
- <containsregexp expression="\[javadoc\]\s*[1-9][0-9]*[\s]*warning"/>
- </not>
- </fileset>
- </delete>
-
- <fail message="Javadocs warnings were found!" >
- <condition>
- <and>
- <available file="@{destdir}/log_javadoc.txt"/>
- <istrue value="${failonjavadocwarning}"/>
- </and>
- </condition>
- </fail>
- </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>
- <artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-7"/>
- <artifact:pom id="maven.project" file="@{pom.xml}"/>
- <artifact:deploy file="@{jar.file}">
- <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="m2-deploy-with-pom-template" description="Builds a Maven artifact given a POM template">
- <attribute name="pom.xml"/>
- <attribute name="jar.file"/>
- <sequential>
- <copy file="@{pom.xml}" tofile="${maven.build.dir}/@{pom.xml}">
- <filterset begintoken="@" endtoken="@">
- <filter token="version" value="${version}"/>
- </filterset>
- </copy>
- <artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-7"/>
- <artifact:pom id="maven.project" file="${maven.build.dir}/@{pom.xml}" />
- <artifact:deploy file="@{jar.file}">
- <remoteRepository url="${m2.repository.url}">
- <authentication username="${m2.repository.username}" privateKey="${m2.repository.private.key}"/>
- </remoteRepository>
- <pom refid="maven.project"/>
- </artifact:deploy>
- </sequential>
- </macrodef>
-
- <property name="gpg.exe" value="gpg" />
- <property name="gpg.key" value="CODE SIGNING KEY" />
- <macrodef name="sign-artifact" description="Signs the artifact">
- <attribute name="input.file"/>
- <attribute name="output.file" default="@{input.file}.asc"/>
- <attribute name="gpg.passphrase"/>
- <sequential>
- <echo >Signing @{input.file} Sig File: @{output.file}</echo>
-
- <exec executable="${gpg.exe}" >
- <arg value="--batch"/>
- <arg value="--armor"/>
- <arg value="--output"/>
- <arg value="@{output.file}"/>
- <arg value="--default-key"/>
- <arg value="${gpg.key}"/>
- <arg value="--passphrase"/>
- <arg value="@{gpg.passphrase}"/>
- <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="gpg.passphrase"/>
- <sequential>
- <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/${version}/@{artifact.id}-${version}.jar" gpg.passphrase="@{gpg.passphrase}"/>
- <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/${version}/@{artifact.id}-${version}-javadoc.jar" gpg.passphrase="@{gpg.passphrase}"/>
- <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/${version}/@{artifact.id}-${version}-sources.jar" gpg.passphrase="@{gpg.passphrase}"/>
- <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/${version}/@{artifact.id}-${version}.pom" gpg.passphrase="@{gpg.passphrase}"/>
- </sequential>
- </macrodef>
-
- <macrodef name="sign-maven-war-artifacts" description="Signs maven artifacts">
- <attribute name="artifact.id"/>
- <attribute name="prefix.dir" default="${maven.dist.prefix}"/>
- <attribute name="gpg.passphrase"/>
- <sequential>
- <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/${version}/@{artifact.id}-${version}.war" gpg.passphrase="@{gpg.passphrase}"/>
- <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/${version}/@{artifact.id}-${version}.pom" gpg.passphrase="@{gpg.passphrase}"/>
- </sequential>
- </macrodef>
-
- <macrodef name="sign-maven-dependency-artifacts" description="Signs a maven artifact and its POM">
- <attribute name="artifact.id"/>
- <attribute name="prefix.dir" default="${maven.dist.prefix}"/>
- <attribute name="gpg.passphrase"/>
- <sequential>
- <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/${version}/@{artifact.id}-${version}.jar" gpg.passphrase="@{gpg.passphrase}"/>
- <sign-artifact input.file="@{prefix.dir}/@{artifact.id}/${version}/@{artifact.id}-${version}.pom" gpg.passphrase="@{gpg.passphrase}"/>
+ <macrodef name="solr-contrib-uptodate">
+ <attribute name="name"/>
+ <attribute name="property" default="@{name}.uptodate"/>
+ <attribute name="classpath.property" default="@{name}.jar"/>
+ <!-- set jarfile only, if the target jar file has no generic name -->
+ <attribute name="jarfile" default="${common-solr.dir}/build/contrib/@{name}/@{name}-${version}.jar"/>
+ <sequential>
+ <!--<echo message="Checking '@{jarfile}' against source folder '${common.dir}/contrib/@{name}/src/java'"/>-->
+ <property name="@{classpath.property}" location="@{jarfile}"/>
+ <uptodate property="@{property}" targetfile="@{jarfile}">
+ <srcfiles dir="${common-solr.dir}/contrib/@{name}/src/main/java" includes="**/*.java"/>
+ </uptodate>
</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 download the Maven ant tasks JAR (maven-ant-tasks-2.1.1.jar)
- from http://maven.apache.org/ant-tasks/download.html and add it to your
- $$HOME/.ant/lib/ directory, or to your $$ANT_HOME/lib/ directory, or
- to your $$CLASSPATH, or add "-lib /path/to/maven-ant-tasks-2.1.1.jar"
- to the ant command.
- ##########################################################################
- </fail>
- </target>
- <!-- Validation -->
- <target name="validate" depends="validate-solr"/>
- <target name="validate-solr" depends="check-legal-solr" unless="validated-solr"/>
-
- <target name="check-legal-solr" depends="compile-tools">
- <java classname="org.apache.lucene.validation.DependencyChecker" failonerror="true" fork="true">
- <classpath>
- <path refid="tools.runtime.classpath" />
- </classpath>
- <!-- TODO: it might be better to just automatically find all directories that contain jar files, but that could take a
- long time. This should be faster, but we could miss a directory
- -->
- <!-- Solr -->
- <arg value="-c" />
- <arg value="${basedir}/lib" />
- <arg value="-c" />
- <arg value="${basedir}/contrib/analysis-extras/lib" />
- <arg value="-c" />
- <arg value="${basedir}/contrib/clustering/lib" />
- <arg value="-c" />
- <arg value="${basedir}/contrib/dataimporthandler/lib" />
- <arg value="-c" />
- <arg value="${basedir}/contrib/extraction/lib" />
- <arg value="-c" />
- <arg value="${basedir}/contrib/uima/lib" />
- <arg value="-c" />
- <arg value="${basedir}/example/example-DIH/solr/db/lib" />
- <arg value="-c" />
- <arg value="${basedir}/example/example-DIH/solr/mail/lib" />
- <arg value="-c" />
- <arg value="${basedir}/example/example/lib" />
- <arg value="-c" />
- <arg value="${basedir}/src/test-files/solr/lib" />
- </java>
- </target>
-
</project>
diff --git a/solr/contrib/analysis-extras/build.xml b/solr/contrib/analysis-extras/build.xml
index 1b135e3c4af..d4c455e4186 100644
--- a/solr/contrib/analysis-extras/build.xml
+++ b/solr/contrib/analysis-extras/build.xml
@@ -17,194 +17,43 @@
limitations under the License.
-->
-<project name="solr-analysis-extras" default="build">
-
- <property name="solr-path" value="../.."/>
-
- <import file="../../common-build.xml"/>
+<project name="solr-analysis-extras" default="default">
<description>
Additional analysis components
</description>
- <property name="example.local" value="example"/>
-
- <!-- support for the additional analyzers modules -->
- <path id="modules.classpath">
- <pathelement location="${common-solr.dir}/../modules/analysis/build/icu/classes/java" />
- <pathelement location="${common-solr.dir}/../modules/analysis/build/smartcn/classes/java" />
- <pathelement location="${common-solr.dir}/../modules/analysis/build/stempel/classes/java" />
- </path>
-
- <target name="prep-module-jars">
- <subant target="jar" inheritall="false" failonerror="true">
- <fileset dir="${common-solr.dir}/../modules/analysis/icu" includes="build.xml" />
- <fileset dir="${common-solr.dir}/../modules/analysis/smartcn" includes="build.xml" />
- <fileset dir="${common-solr.dir}/../modules/analysis/stempel" includes="build.xml" />
- </subant>
- </target>
-
- <target name="module-jars-to-solr" depends="prep-module-jars">
- <mkdir dir="${lucene-libs}"/>
- <copy todir="${lucene-libs}" preservelastmodified="true" flatten="true" failonerror="true" overwrite="true">
- <fileset dir="${common-solr.dir}/../modules/analysis/build/icu">
- <include name="lucene-analyzers-icu-${version}.jar" />
- </fileset>
- <fileset dir="${common-solr.dir}/../modules/analysis/build/smartcn">
- <include name="lucene-analyzers-smartcn-${version}.jar" />
- </fileset>
- <fileset dir="${common-solr.dir}/../modules/analysis/build/stempel">
- <include name="lucene-analyzers-stempel-${version}.jar" />
- </fileset>
- </copy>
- </target>
-
- <path id="common.classpath">
- <fileset dir="lib"/>
- <pathelement location="${solr-path}/build/solr"/>
- <pathelement location="${solr-path}/build/solrj"/>
- <path refid="lucene.classpath"/>
- <path refid="modules.classpath"/>
- <fileset dir="${solr-path}/lib" includes="*.jar"/>
- </path>
-
- <path id="test.classpath">
- <pathelement path="${dest}/classes"/>
- <pathelement path="${dest}/test-classes"/>
- <pathelement path="${java.class.path}"/>
- <pathelement location="${common-solr.dir}/build/tests"/> <!-- include solr test code -->
- <pathelement location="${common-solr.dir}/../lucene/build/classes/test-framework" /> <!-- include some lucene test code -->
- <path refid="common.classpath"/>
- </path>
-
- <target name="clean">
- <delete failonerror="false" dir="${dest}"/>
+ <property name="src.dir" location="src/java"/>
+ <property name="tests.src.dir" location="src/test"/>
+ <property name="tests.userdir" location="src/test-files"/>
- <!-- example doesn't create this anymore, but clean it up
- if it's still there from an old build
- -->
- <delete dir="example/lib" />
- <delete dir="${lucene-libs}" />
- </target>
-
-
- <target name="init" depends="module-jars-to-solr">
- <mkdir dir="${dest}/classes"/>
-
- <mkdir dir="${build.javadoc}"/>
- <subant target="compileTests">
- <fileset dir="${solr-path}" includes="build.xml"/>
- </subant>
- <subant target="make-manifest">
- <fileset dir="${solr-path}" includes="build.xml"/>
- </subant>
- </target>
+ <import file="../contrib-build.xml"/>
+ <module-uptodate name="analysis/icu" jarfile="${common.dir}/../modules/analysis/build/icu/lucene-analyzers-icu-${version}.jar"
+ property="analyzers-icu.uptodate" classpath.property="analyzers-icu.jar"/>
+ <module-uptodate name="analysis/smartcn" jarfile="${common.dir}/../modules/analysis/build/smartcn/lucene-analyzers-smartcn-${version}.jar"
+ property="analyzers-smartcn.uptodate" classpath.property="analyzers-smartcn.jar"/>
+ <module-uptodate name="analysis/stempel" jarfile="${common.dir}/../modules/analysis/build/stempel/lucene-analyzers-stempel-${version}.jar"
+ property="analyzers-stempel.uptodate" classpath.property="analyzers-stempel.jar"/>
- <target name="compile" depends="init">
- <solr-javac destdir="${dest}/classes"
- classpathref="common.classpath">
- <src path="src/java"/>
- </solr-javac>
- </target>
-
- <target name="build" depends="compile">
- <solr-jar destfile="${dest}/${fullnamever}.jar" basedir="${dest}/classes"
- manifest="../../${dest}/META-INF/MANIFEST.MF"/>
- </target>
-
- <target name="compileTests" depends="compile">
- <solr-javac destdir="${dest}/test-classes"
- classpathref="test.classpath">
- <src path="src/test"/>
- </solr-javac>
- <!-- Copy any data files present to the classpath -->
- <copy todir="${dest}/test-classes">
- <fileset dir="src/test-files" excludes="**/*.java"/>
- </copy>
- </target>
-
- <target name="example" depends="build,dist">
- <!-- this task use to copy lib's but that's no longer needed because
- ../lib and ../lib/downloads are now included explicitly by
- example/conf/solrconfig.xml
- -->
- </target>
-
-
- <target name="test" depends="compileTests">
- <mkdir dir="${junit.output.dir}"/>
-
- <junit printsummary="no"
- haltonfailure="no"
- maxmemory="512M"
- errorProperty="tests.failed"
- failureProperty="tests.failed"
- dir="${junit.output.dir}"
- tempdir="${junit.output.dir}"
- forkmode="perBatch"
- >
- <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>
- <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
- <sysproperty key="tests.codec" value="${tests.codec}"/>
- <sysproperty key="tests.locale" value="${tests.locale}"/>
- <sysproperty key="tests.timezone" value="${tests.timezone}"/>
- <sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
- <sysproperty key="tests.seed" value="${tests.seed}"/>
- <sysproperty key="tests.verbose" value="${tests.verbose}"/>
- <sysproperty key="tests.iter" value="${tests.iter}"/>
- <!-- set whether or not nightly tests should run -->
- <sysproperty key="tests.nightly" value="${tests.nightly}"/>
- <sysproperty key="jetty.testMode" value="1"/>
- <sysproperty key="tempDir" file="${junit.output.dir}"/>
- <sysproperty key="testmethod" value="${testmethod}"/>
- <jvmarg line="${args}"/>
- <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
- <classpath refid="test.classpath"/>
- <assertions>
- <enable package="org.apache.lucene"/>
- <enable package="org.apache.solr"/>
- </assertions>
- <formatter type="${junit.formatter}"/>
- <batchtest fork="yes" todir="${junit.output.dir}" unless="testcase">
- <fileset dir="src/test" includes="${junit.includes}"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
- <fileset dir="src/test" includes="**/${testcase}.java"/>
- </batchtest>
- </junit>
+ <path id="classpath">
+ <pathelement path="${analyzers-icu.jar}"/>
+ <pathelement path="${analyzers-smartcn.jar}"/>
+ <pathelement path="${analyzers-stempel.jar}"/>
+ <path refid="solr.base.classpath"/>
+ </path>
- <fail if="tests.failed">Tests failed!</fail>
+ <target name="compile-analyzers-icu" unless="analyzers-icu.uptodate">
+ <ant dir="${common.dir}/../modules/analysis/icu" target="default" inheritAll="false"/>
</target>
- <target name="dist" depends="build">
- <!--
- <copy file="${dest}/${fullnamever}.jar" todir="${solr-path}/build/web/WEB-INF/lib"/>
- <copy todir="${solr-path}/build/web/WEB-INF/lib" flatten="true">
- <fileset dir="lib">
- <include name="**/*.jar"/>
- </fileset>
- </copy>
- -->
- <copy file="${dest}/${fullnamever}.jar" todir="${solr-path}/dist"/>
+ <target name="compile-analyzers-smartcn" unless="analyzers-smartcn.uptodate">
+ <ant dir="${common.dir}/../modules/analysis/smartcn" target="default" inheritAll="false"/>
</target>
- <target name="javadoc">
- <sequential>
- <mkdir dir="${build.javadoc}/contrib-${name}"/>
-
- <path id="javadoc.classpath">
- <path refid="common.classpath"/>
- </path>
-
- <invoke-javadoc
- destdir="${build.javadoc}/contrib-${name}"
- title="${Name} ${version} contrib-${fullnamever} API">
- <sources>
- <packageset dir="src/java"/>
- </sources>
- </invoke-javadoc>
- </sequential>
+ <target name="compile-analyzers-stempel" unless="analyzers-stempel.uptodate">
+ <ant dir="${common.dir}/../modules/analysis/stempel" target="default" inheritAll="false"/>
</target>
+ <target name="compile-core" depends="compile-analyzers-icu, compile-analyzers-smartcn, compile-analyzers-stempel, solr-contrib-build.compile-core"/>
</project>
diff --git a/solr/contrib/clustering/build.xml b/solr/contrib/clustering/build.xml
index 7090ca710bc..799ce0f77fe 100644
--- a/solr/contrib/clustering/build.xml
+++ b/solr/contrib/clustering/build.xml
@@ -17,168 +17,15 @@
limitations under the License.
-->
-<project name="solr-clustering" default="build">
-
- <property name="solr-path" value="../.."/>
-
- <import file="../../common-build.xml"/>
+<project name="solr-clustering" default="default">
<description>
Clustering Integraton
</description>
- <property name="example.local" value="example"/>
-
- <path id="common.classpath">
- <fileset dir="lib" includes="*.jar"/>
- <pathelement location="${solr-path}/build/solr"/>
- <pathelement location="${solr-path}/build/solrj"/>
- <path refid="lucene.classpath"/>
- <fileset dir="${solr-path}/lib" includes="*.jar"/>
- </path>
-
- <path id="test.classpath">
- <pathelement path="${dest}/classes"/>
- <pathelement path="${dest}/test-classes"/>
- <pathelement path="${java.class.path}"/>
- <pathelement location="${common-solr.dir}/build/tests"/> <!-- include solr test code -->
- <pathelement location="${common-solr.dir}/../lucene/build/classes/test-framework" /> <!-- include some lucene test code -->
- <path refid="common.classpath"/>
- <!-- DistributedClusteringComponentTest uses Jetty -->
- <fileset dir="${solr-path}/example/lib">
- <include name="**/*.jar" />
- </fileset>
- </path>
-
- <target name="clean">
- <delete failonerror="false" dir="${dest}"/>
-
- <!-- example doesn't create this anymore, but clean it up
- if it's still there from an old build
- -->
- <delete dir="example/lib" />
- </target>
-
-
- <target name="init">
- <mkdir dir="${dest}/classes"/>
-
- <mkdir dir="${build.javadoc}"/>
- <subant target="compileTests">
- <fileset dir="${solr-path}" includes="build.xml"/>
- </subant>
- <subant target="make-manifest">
- <fileset dir="${solr-path}" includes="build.xml"/>
- </subant>
- </target>
-
-
- <target name="compile" depends="init">
- <solr-javac destdir="${dest}/classes"
- classpathref="common.classpath">
- <src path="src/main/java"/>
- </solr-javac>
- </target>
-
- <target name="build" depends="compile">
- <solr-jar destfile="${dest}/${fullnamever}.jar" basedir="${dest}/classes"
- manifest="../../${dest}/META-INF/MANIFEST.MF"/>
- </target>
-
- <target name="compileTests" depends="compile">
- <solr-javac destdir="${dest}/test-classes"
- classpathref="test.classpath">
- <src path="src/test/java"/>
- </solr-javac>
- <!-- Copy any data files present to the classpath -->
- <copy todir="${dest}/test-classes">
- <fileset dir="src/test/resources" excludes="**/*.java"/>
- </copy>
- </target>
-
- <target name="example" depends="build,dist">
- <!-- this task use to copy lib's but that's no longer needed because
- ../lib and ../lib/downloads are now included explicitly by
- example/conf/solrconfig.xml
- -->
- </target>
-
-
- <target name="test" depends="compileTests">
- <mkdir dir="${junit.output.dir}"/>
-
- <junit printsummary="no"
- haltonfailure="no"
- maxmemory="512M"
- errorProperty="tests.failed"
- failureProperty="tests.failed"
- dir="${junit.output.dir}"
- tempdir="${junit.output.dir}"
- forkmode="perBatch"
- >
- <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>
- <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
- <sysproperty key="tests.codec" value="${tests.codec}"/>
- <sysproperty key="tests.locale" value="${tests.locale}"/>
- <sysproperty key="tests.timezone" value="${tests.timezone}"/>
- <sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
- <sysproperty key="tests.seed" value="${tests.seed}"/>
- <sysproperty key="tests.verbose" value="${tests.verbose}"/>
- <sysproperty key="tests.iter" value="${tests.iter}"/>
- <!-- set whether or not nightly tests should run -->
- <sysproperty key="tests.nightly" value="${tests.nightly}"/>
- <sysproperty key="jetty.testMode" value="1"/>
- <sysproperty key="tempDir" file="${junit.output.dir}"/>
- <sysproperty key="testmethod" value="${testmethod}"/>
- <jvmarg line="${args}"/>
- <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
- <classpath refid="test.classpath"/>
- <assertions>
- <enable package="org.apache.lucene"/>
- <enable package="org.apache.solr"/>
- </assertions>
- <formatter type="${junit.formatter}"/>
- <batchtest fork="yes" todir="${junit.output.dir}" unless="testcase">
- <fileset dir="src/test/java" includes="${junit.includes}">
- <exclude name="**/AbstractClusteringTest*"/>
- </fileset>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
- <fileset dir="src/test/java" includes="**/${testcase}.java"/>
- </batchtest>
- </junit>
-
- <fail if="tests.failed">Tests failed!</fail>
- </target>
-
- <target name="dist" depends="build">
- <!--
- <copy file="${dest}/${fullnamever}.jar" todir="${solr-path}/build/web/WEB-INF/lib"/>
- <copy todir="${solr-path}/build/web/WEB-INF/lib" flatten="true">
- <fileset dir="lib">
- <include name="**/*.jar"/>
- </fileset>
- </copy>
- -->
- <copy file="${dest}/${fullnamever}.jar" todir="${solr-path}/dist"/>
- </target>
-
- <target name="javadoc">
- <sequential>
- <mkdir dir="${build.javadoc}/contrib-${name}"/>
-
- <path id="javadoc.classpath">
- <path refid="common.classpath"/>
- </path>
-
- <invoke-javadoc
- destdir="${build.javadoc}/contrib-${name}"
- title="${Name} ${version} contrib-${fullnamever} API">
- <sources>
- <packageset dir="src/main/java"/>
- </sources>
- </invoke-javadoc>
- </sequential>
- </target>
+ <property name="src.dir" location="src/main/java"/>
+ <property name="tests.src.dir" location="src/test/java"/>
+ <property name="tests.userdir" location="src/test/resources"/>
+ <import file="../contrib-build.xml"/>
</project>
diff --git a/solr/contrib/contrib-build.xml b/solr/contrib/contrib-build.xml
new file mode 100644
index 00000000000..252f357eb60
--- /dev/null
+++ b/solr/contrib/contrib-build.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+
+<!--
+ 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-contrib-build">
+ <!-- TODO: adjust build.dir/dist.dir appropriately when a contrib project is run individually -->
+ <property name="build.dir" location="../../build/contrib/${ant.project.name}"/>
+ <property name="dist.dir" location="../../dist/"/>
+
+ <import file="../common-build.xml"/>
+
+ <target name="build-solr" unless="solr.core.compiled">
+ <ant dir="${common-solr.dir}" target="compile-test" inheritAll="false"/>
+ <!-- set the property for this ant execution to speed up later tasks depending on this -->
+ <property name="solr.core.compiled" value="true"/>
+ </target>
+
+ <target name="compile-core" depends="build-solr, common.compile-core"/>
+
+ <macrodef name="solr-contrib-uptodate">
+ <attribute name="name"/>
+ <attribute name="property" default="solr-@{name}.uptodate"/>
+ <attribute name="classpath.property" default="solr-@{name}.jar"/>
+ <!-- set jarfile only, if the target jar file has no generic name -->
+ <attribute name="jarfile" default="${common-solr.dir}/build/contrib/solr-@{name}/apache-solr-@{name}-${version}.jar"/>
+ <sequential>
+ <!--<echo message="Checking '@{jarfile}' against source folder '${common.dir}/contrib/@{name}/src/java'"/>-->
+ <property name="@{classpath.property}" location="@{jarfile}"/>
+ <uptodate property="@{property}" targetfile="@{jarfile}">
+ <srcfiles dir="../@{name}/src/main/java" includes="**/*.java"/>
+ </uptodate>
+ </sequential>
+ </macrodef>
+</project>
diff --git a/solr/contrib/dataimporthandler-extras/build.xml b/solr/contrib/dataimporthandler-extras/build.xml
new file mode 100644
index 00000000000..d03b584b0e5
--- /dev/null
+++ b/solr/contrib/dataimporthandler-extras/build.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+
+<!--
+ 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-dataimporthandler-extras" default="default">
+
+ <description>
+ Data Import Handler Extras
+ </description>
+
+ <property name="src.dir" location="src/main/java"/>
+ <property name="tests.src.dir" location="src/test/java"/>
+ <property name="tests.userdir" location="src/test/resources"/>
+
+ <import file="../contrib-build.xml"/>
+
+ <solr-contrib-uptodate name="dataimporthandler"
+ property="solr-dataimporthandler.uptodate"
+ classpath.property="solr-dataimporthandler.jar"/>
+
+ <target name="compile-solr-dataimporthandler" unless="solr-dataimporthandler.uptodate">
+ <ant dir="${common-solr.dir}/contrib/dataimporthandler" target="default" inheritAll="false"/>
+ </target>
+
+ <!--
+ really sucks we do this always, without an up-to-date thing for tests
+ we should probably fix this, the same issue exists in modules
+ -->
+ <target name="compile-solr-dataimporthandler-tests">
+ <ant dir="${common-solr.dir}/contrib/dataimporthandler" target="compile-test" inheritAll="false"/>
+ </target>
+
+ <path id="classpath">
+ <pathelement location="${common-solr.dir}/build/contrib/solr-dataimporthandler/classes/java"/>
+ <pathelement location="${common-solr.dir}/build/contrib/solr-dataimporthandler/classes/test"/>
+ <fileset dir="${common-solr.dir}/contrib/dataimporthandler/lib" includes="**/*.jar"/>
+ <fileset dir="${common-solr.dir}/contrib/extraction/lib" includes="**/*.jar"/>
+ <path refid="solr.base.classpath"/>
+ </path>
+
+ <target name="compile-core" depends="compile-solr-dataimporthandler, solr-contrib-build.compile-core"/>
+ <target name="compile-test" depends="compile-solr-dataimporthandler-tests, contrib-build.compile-test"/>
+</project>
diff --git a/solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java b/solr/contrib/dataimporthandler-extras/src/main/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java
similarity index 100%
rename from solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java
rename to solr/contrib/dataimporthandler-extras/src/main/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java
diff --git a/solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java b/solr/contrib/dataimporthandler-extras/src/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java
similarity index 100%
rename from solr/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java
rename to solr/contrib/dataimporthandler-extras/src/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java
diff --git a/solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestMailEntityProcessor.java b/solr/contrib/dataimporthandler-extras/src/test/java/org/apache/solr/handler/dataimport/TestMailEntityProcessor.java
similarity index 100%
rename from solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestMailEntityProcessor.java
rename to solr/contrib/dataimporthandler-extras/src/test/java/org/apache/solr/handler/dataimport/TestMailEntityProcessor.java
diff --git a/solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java b/solr/contrib/dataimporthandler-extras/src/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java
similarity index 100%
rename from solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java
rename to solr/contrib/dataimporthandler-extras/src/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java
diff --git a/solr/contrib/dataimporthandler/src/extras/test/resources/solr-dihextras/conf/dataimport-schema-no-unique-key.xml b/solr/contrib/dataimporthandler-extras/src/test/resources/solr-dihextras/conf/dataimport-schema-no-unique-key.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/extras/test/resources/solr-dihextras/conf/dataimport-schema-no-unique-key.xml
rename to solr/contrib/dataimporthandler-extras/src/test/resources/solr-dihextras/conf/dataimport-schema-no-unique-key.xml
diff --git a/solr/contrib/dataimporthandler/src/extras/test/resources/solr-dihextras/conf/dataimport-solrconfig.xml b/solr/contrib/dataimporthandler-extras/src/test/resources/solr-dihextras/conf/dataimport-solrconfig.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/extras/test/resources/solr-dihextras/conf/dataimport-solrconfig.xml
rename to solr/contrib/dataimporthandler-extras/src/test/resources/solr-dihextras/conf/dataimport-solrconfig.xml
diff --git a/solr/contrib/dataimporthandler/src/extras/test/resources/solr-word.pdf b/solr/contrib/dataimporthandler-extras/src/test/resources/solr-word.pdf
similarity index 100%
rename from solr/contrib/dataimporthandler/src/extras/test/resources/solr-word.pdf
rename to solr/contrib/dataimporthandler-extras/src/test/resources/solr-word.pdf
diff --git a/solr/contrib/dataimporthandler/build.xml b/solr/contrib/dataimporthandler/build.xml
index 5b9ddc18dec..bdb0cd5e6cb 100644
--- a/solr/contrib/dataimporthandler/build.xml
+++ b/solr/contrib/dataimporthandler/build.xml
@@ -17,295 +17,16 @@
limitations under the License.
-->
-<project name="solr-dataimporthandler" default="build">
+<project name="solr-dataimporthandler" default="default">
- <property name="solr-path" value="../.." />
- <property name="tikalibs-path" value="../extraction/lib" />
-
- <import file="../../common-build.xml"/>
-
<description>
Data Import Handler
</description>
- <path id="classpath.jetty">
- <!-- jetty -->
- <fileset dir="${solr-path}/example/lib">
- <include name="**/*.jar" />
- </fileset>
- </path>
- <path id="common.classpath">
- <pathelement location="${solr-path}/build/solr" />
- <pathelement location="${solr-path}/build/solrj" />
- <fileset dir="${solr-path}/lib" includes="*.jar"/>
- <path refid="lucene.classpath"/>
- </path>
-
- <path id="extras.classpath">
- <pathelement location="${solr-path}/build/solr" />
- <pathelement location="${solr-path}/build/solrj" />
- <pathelement location="target/classes" />
- <fileset dir="${solr-path}/lib" includes="*.jar"/>
- <fileset dir="lib/" includes="*.jar"/>
- <fileset dir="${tikalibs-path}" includes="*.jar"/>
- <path refid="lucene.classpath"/>
- </path>
-
- <path id="test.classpath">
- <path refid="common.classpath" />
- <path refid="classpath.jetty" />
- <pathelement path="target/classes" />
- <pathelement path="target/test-classes" />
- <pathelement location="${solr-path}/build/tests"/> <!-- include solr test code -->
- <pathelement location="${solr-path}/../lucene/build/classes/test-framework" /> <!-- include some lucene test code -->
- <pathelement path="${java.class.path}"/>
- </path>
-
- <path id="test.extras.classpath">
- <path refid="extras.classpath" />
- <path refid="classpath.jetty" />
- <pathelement path="target/classes" />
- <pathelement path="target/extras/classes" />
- <pathelement path="target/test-classes" />
- <pathelement path="target/extras/test-classes" />
- <pathelement location="${solr-path}/build/tests"/> <!-- include solr test code -->
- <pathelement location="${solr-path}/../lucene/build/classes/test-framework" /> <!-- include some lucene test code -->
- <pathelement path="${java.class.path}"/>
- </path>
-
- <target name="clean">
- <delete failonerror="false" dir="target"/>
- <delete failonerror="false">
- <fileset dir="src/test/resources" includes="**/dataimport.properties" />
- </delete>
- <!-- Clean up examples -->
- <delete failonerror="false">
- <!-- we no longer copy things into this directory, but we still clean it up
- the files are still there from a previous checkout
- -->
- <fileset dir="${example}/example-DIH/solr/mail/lib" includes="*.jar" />
- </delete>
- </target>
-
- <target name="init">
- <mkdir dir="target/classes"/>
- <mkdir dir="${build.javadoc}" />
- <subant target="compileTests">
- <fileset dir="${solr-path}" includes="build.xml"/>
- </subant>
- <subant target="make-manifest">
- <fileset dir="${solr-path}" includes="build.xml"/>
- </subant>
- </target>
-
- <target name="compile" depends="init">
- <solr-javac destdir="target/classes"
- classpathref="common.classpath">
- <src path="src/main/java" />
- </solr-javac>
- </target>
-
- <target name="compileExtras" depends="compile">
- <solr-javac destdir="target/extras/classes"
- classpathref="extras.classpath">
- <src path="src/extras/main/java" />
- </solr-javac>
- </target>
-
- <target name="build" depends="compile,compileExtras">
- <solr-jar destfile="target/${fullnamever}.jar" basedir="target/classes"
- manifest="../../${dest}/META-INF/MANIFEST.MF" />
- <solr-jar destfile="target/apache-${ant.project.name}-extras-${version}.jar" basedir="target/extras/classes"
- manifest="../../${dest}/META-INF/MANIFEST.MF" />
- </target>
-
- <target name="compileTests" depends="compile">
- <solr-javac destdir="target/test-classes"
- classpathref="test.classpath">
- <src path="src/test/java" />
- </solr-javac>
- <!-- Copy any data files present to the classpath -->
- <copy todir="target/test-classes">
- <fileset dir="src/test/resources" excludes="**/*.java"/>
- </copy>
- </target>
-
- <target name="compileExtrasTests" depends="compileExtras">
- <solr-javac destdir="target/extras/test-classes"
- classpathref="test.classpath">
- <src path="src/extras/test/java" />
- </solr-javac>
- <!-- Copy any data files present to the classpath -->
- <copy todir="target/extras/test-classes">
- <fileset dir="src/extras/test/resources" excludes="**/*.java"/>
- </copy>
- </target>
-
- <property name="tempDir" value="${junit.output.dir}/temp" />
- <target name="test" depends="testCore,testExtras"/>
-
- <target name="testCore" depends="compileTests">
- <mkdir dir="${junit.output.dir}"/>
- <!-- <mkdir dir="@{tempDir}/@{pattern}"/>
- This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
- -->
- <touch file="${tempDir}/quiet.ant" verbose="false" mkdirs="true"/>
- <condition property="runall">
- <not>
- <or>
- <isset property="testcase"/>
- <isset property="testpackage"/>
- <isset property="testpackageroot"/>
- </or>
- </not>
- </condition>
-
- <junit printsummary="no"
- haltonfailure="no"
- maxmemory="512M"
- errorProperty="tests.failed"
- failureProperty="tests.failed"
- dir="${tempDir}"
- tempdir="${tempDir}"
- forkmode="perBatch"
- >
- <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>
- <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
- <sysproperty key="tests.codec" value="${tests.codec}"/>
- <sysproperty key="tests.locale" value="${tests.locale}"/>
- <sysproperty key="tests.timezone" value="${tests.timezone}"/>
- <sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
- <sysproperty key="tests.iter" value="${tests.iter}"/>
- <sysproperty key="tests.seed" value="${tests.seed}"/>
- <sysproperty key="tests.verbose" value="${tests.verbose}"/>
- <!-- set whether or not nightly tests should run -->
- <sysproperty key="tests.nightly" value="${tests.nightly}"/>
- <sysproperty key="jetty.testMode" value="1"/>
- <sysproperty key="tempDir" file="${tempDir}"/>
- <sysproperty key="testmethod" value="${testmethod}"/>
- <jvmarg line="${args}"/>
- <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
- <classpath refid="test.classpath"/>
- <formatter type="${junit.formatter}"/>
- <batchtest fork="yes" todir="${junit.output.dir}" if="runall">
- <fileset dir="src/test/java" includes="${junit.includes}"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
- <fileset dir="src/test/java" includes="**/${testcase}.java"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testpackage">
- <fileset dir="src/test/java" includes="**/${testpackage}/**/Test*.java,**/${testpackage}/**/*Test.java"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testpackageroot">
- <fileset dir="src/test/java" includes="**/${testpackageroot}/Test*.java,**/${testpackageroot}/*Test.java"/>
- </batchtest>
- </junit>
-
- <fail if="tests.failed">Tests failed!</fail>
- </target>
-
- <target name="testExtras" depends="compileExtrasTests">
- <mkdir dir="${junit.output.dir}"/>
- <!-- <mkdir dir="@{tempDir}/@{pattern}"/>
- This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
- -->
- <touch file="${tempDir}/quiet.ant" verbose="false" mkdirs="true"/>
-
- <condition property="runall">
- <not>
- <or>
- <isset property="testcase"/>
- <isset property="testpackage"/>
- <isset property="testpackageroot"/>
- </or>
- </not>
- </condition>
-
- <junit printsummary="no"
- haltonfailure="no"
- maxmemory="512M"
- errorProperty="tests.failed"
- failureProperty="tests.failed"
- dir="${tempDir}"
- tempdir="${tempDir}"
- forkmode="perBatch"
- >
- <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>
- <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
- <sysproperty key="tests.codec" value="${tests.codec}"/>
- <sysproperty key="tests.locale" value="${tests.locale}"/>
- <sysproperty key="tests.timezone" value="${tests.timezone}"/>
- <sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
- <sysproperty key="tests.iter" value="${tests.iter}"/>
- <sysproperty key="tests.seed" value="${tests.seed}"/>
- <sysproperty key="tests.verbose" value="${tests.verbose}"/>
- <!-- set whether or not nightly tests should run -->
- <sysproperty key="tests.nightly" value="${tests.nightly}"/>
- <sysproperty key="jetty.testMode" value="1"/>
- <sysproperty key="tempDir" file="${tempDir}"/>
- <sysproperty key="testmethod" value="${testmethod}"/>
- <jvmarg line="${args}"/>
- <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
- <classpath refid="test.extras.classpath"/>
- <assertions>
- <enable package="org.apache.lucene"/>
- <enable package="org.apache.solr"/>
- </assertions>
- <formatter type="${junit.formatter}"/>
-
- <batchtest fork="yes" todir="${junit.output.dir}" if="runall">
- <fileset dir="src/extras/test/java" includes="${junit.includes}"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
- <fileset dir="src/extras/test/java" includes="**/${testcase}.java"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testpackage">
- <fileset dir="src/extras/test/java" includes="**/${testpackage}/**/Test*.java,**/${testpackage}/**/*Test.java"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testpackageroot">
- <fileset dir="src/extras/test/java" includes="**/${testpackageroot}/Test*.java,**/${testpackageroot}/*Test.java"/>
- </batchtest>
-
-
- </junit>
-
- <fail if="tests.failed">Tests failed!</fail>
- </target>
-
- <target name="dist" depends="build">
- <copy todir="../../build/web">
- <fileset dir="src/main/webapp" includes="**" />
- </copy>
- <mkdir dir="../../build/web/WEB-INF/lib"/>
- <!--<copy file="target/${fullnamever}.jar" todir="${solr-path}/build/web/WEB-INF/lib"></copy>-->
- <copy file="target/${fullnamever}.jar" todir="${solr-path}/dist"></copy>
- <copy file="target/apache-${ant.project.name}-extras-${version}.jar" todir="${solr-path}/dist"></copy>
- </target>
-
- <target name="javadoc">
- <sequential>
- <mkdir dir="${build.javadoc}/contrib-${name}"/>
-
- <path id="javadoc.classpath">
- <path refid="common.classpath"/>
- <path refid="extras.classpath"/>
- </path>
- <invoke-javadoc
- destdir="${build.javadoc}/contrib-${name}"
- title="${Name} ${version} contrib-${fullnamever} API">
- <sources>
- <packageset dir="src/main/java"/>
- <packageset dir="src/extras/main/java"/>
- </sources>
- </invoke-javadoc>
- </sequential>
- </target>
+ <property name="src.dir" location="src/main/java"/>
+ <property name="tests.src.dir" location="src/test/java"/>
+ <property name="tests.userdir" location="src/test/resources"/>
- <target name="example" depends="build,dist">
- <!--
- this target use to copy libs, but that is no longer needed.
- now we just depend on dist to ensure the extra's jar exists.
- -->
- </target>
+ <import file="../contrib-build.xml"/>
</project>
diff --git a/solr/contrib/extraction/build.xml b/solr/contrib/extraction/build.xml
index de7542d54b4..112d1731549 100644
--- a/solr/contrib/extraction/build.xml
+++ b/solr/contrib/extraction/build.xml
@@ -17,177 +17,16 @@
limitations under the License.
-->
-<project name="solr-cell" default="build">
+<project name="solr-cell" default="default">
- <property name="solr-path" value="../.." />
-
- <import file="../../common-build.xml"/>
-
<description>
Solr Integration with Tika for extracting content from binary file formats such as Microsoft Word and Adobe PDF.
</description>
- <path id="common.classpath">
- <pathelement location="${solr-path}/build/solr" />
- <pathelement location="${solr-path}/build/solrj" />
- <fileset dir="lib" includes="*.jar"/>
- <fileset dir="${solr-path}/lib" includes="*.jar"/>
- <path refid="lucene.classpath"/>
- </path>
-
- <path id="test.classpath">
- <path refid="common.classpath" />
- <pathelement path="${dest}/classes" />
- <pathelement path="${dest}/test-classes" />
- <pathelement location="${solr-path}/build/tests"/> <!-- include solr test code -->
- <pathelement location="${solr-path}/../lucene/build/classes/test-framework" /> <!-- include some lucene test code -->
- <pathelement path="${java.class.path}"/>
- </path>
-
- <target name="clean">
- <delete failonerror="false" dir="${dest}"/>
- </target>
-
- <target name="init">
- <mkdir dir="${dest}/classes"/>
- <mkdir dir="${build.javadoc}" />
- <subant target="compileTests">
- <fileset dir="${solr-path}" includes="build.xml"/>
- </subant>
- <subant target="make-manifest">
- <fileset dir="${solr-path}" includes="build.xml"/>
- </subant>
-
- </target>
-
- <target name="compile" depends="init">
- <solr-javac destdir="${dest}/classes"
- classpathref="common.classpath">
- <src path="src/main/java" />
- </solr-javac>
- </target>
-
- <target name="build" depends="compile">
- <solr-jar destfile="${dest}/${fullnamever}.jar" basedir="${dest}/classes"
- manifest="../../${dest}/META-INF/MANIFEST.MF">
-
- </solr-jar>
- </target>
-
- <target name="compileTests" depends="compile">
- <solr-javac destdir="${dest}/test-classes"
- classpathref="test.classpath">
- <src path="src/test/java" />
- </solr-javac>
- <!-- Copy any data files present to the classpath -->
- <copy todir="${dest}/test-classes">
- <fileset dir="src/test/resources" excludes="**/*.java"/>
- </copy>
- </target>
-
- <property name="tempDir" value="${junit.output.dir}/temp" />
-
- <target name="test" depends="compileTests">
- <mkdir dir="${junit.output.dir}"/>
- <!-- <mkdir dir="@{tempDir}/@{pattern}"/>
- This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
- -->
- <touch file="${tempDir}/quiet.ant" verbose="false" mkdirs="true"/>
-
- <condition property="runall">
- <not>
- <or>
- <isset property="testcase"/>
- <isset property="testpackage"/>
- <isset property="testpackageroot"/>
- </or>
- </not>
- </condition>
-
- <junit printsummary="no"
- haltonfailure="no"
- maxmemory="512M"
- errorProperty="tests.failed"
- failureProperty="tests.failed"
- dir="${tempDir}"
- tempdir="${tempDir}"
- forkmode="perBatch"
- >
- <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>
- <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
- <sysproperty key="tests.codec" value="${tests.codec}"/>
- <sysproperty key="tests.locale" value="${tests.locale}"/>
- <sysproperty key="tests.timezone" value="${tests.timezone}"/>
- <sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
- <sysproperty key="tests.iter" value="${tests.iter}"/>
- <sysproperty key="tests.seed" value="${tests.seed}"/>
- <sysproperty key="tests.verbose" value="${tests.verbose}"/>
- <!-- set whether or not nightly tests should run -->
- <sysproperty key="tests.nightly" value="${tests.nightly}"/>
- <sysproperty key="jetty.testMode" value="1"/>
- <sysproperty key="tempDir" file="${tempDir}"/>
- <sysproperty key="testmethod" value="${testmethod}"/>
- <jvmarg line="${args}"/>
- <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
- <classpath refid="test.classpath"/>
- <assertions>
- <enable package="org.apache.lucene"/>
- <enable package="org.apache.solr"/>
- </assertions>
- <formatter type="${junit.formatter}"/>
- <batchtest fork="yes" todir="${junit.output.dir}" if="runall">
- <fileset dir="src/test/java" includes="${junit.includes}"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
- <fileset dir="src/test/java" includes="**/${testcase}.java"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testpackage">
- <fileset dir="src/test/java" includes="**/${testpackage}/**/Test*.java,**/${testpackage}/**/*Test.java"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testpackageroot">
- <fileset dir="src/test/java" includes="**/${testpackageroot}/Test*.java,**/${testpackageroot}/*Test.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="dist" depends="build">
- <copy file="build/${fullnamever}.jar" todir="${solr-path}/dist"/>
- </target>
-
- <target name="example" depends="build">
- <!-- :NOOP: this use to copy libs but now we can refer to them by path -->
- </target>
-
- <target name="javadoc">
- <sequential>
- <mkdir dir="${build.javadoc}/contrib-${name}"/>
-
- <path id="javadoc.classpath">
- <path refid="common.classpath"/>
- </path>
-
- <invoke-javadoc
- destdir="${build.javadoc}/contrib-${name}"
- title="${Name} ${version} contrib-${fullnamever} API">
- <sources>
- <packageset dir="src/main/java"/>
- </sources>
- </invoke-javadoc>
- </sequential>
- </target>
+ <property name="src.dir" location="src/main/java"/>
+ <property name="tests.src.dir" location="src/test/java"/>
+ <property name="tests.userdir" location="src/test/resources"/>
+ <import file="../contrib-build.xml"/>
</project>
diff --git a/solr/contrib/uima/build.xml b/solr/contrib/uima/build.xml
index 34dbefec748..085b96c0ffb 100644
--- a/solr/contrib/uima/build.xml
+++ b/solr/contrib/uima/build.xml
@@ -17,173 +17,16 @@
limitations under the License.
-->
-<project name="solr-uima" default="build">
+<project name="solr-uima" default="default">
- <property name="solr-path" value="../.." />
-
- <import file="../../common-build.xml"/>
-
<description>
Solr Integration with UIMA for extracting metadata from arbitrary (text) fields and enrich document with features extracted from UIMA types (language, sentences, concepts, named entities, etc.)
</description>
- <path id="common.classpath">
- <pathelement location="${solr-path}/build/solr" />
- <pathelement location="${solr-path}/build/solrj" />
- <fileset dir="lib" includes="*.jar"/>
- <fileset dir="${solr-path}/lib" includes="*.jar"/>
- <path refid="lucene.classpath"/>
- <pathelement location="${basedir}/src/main/resources" />
- </path>
-
- <path id="test.classpath">
- <path refid="common.classpath" />
- <pathelement path="${dest}/classes" />
- <pathelement path="${dest}/test-classes" />
- <pathelement location="${solr-path}/build/tests"/> <!-- include solr test code -->
- <pathelement location="${solr-path}/../lucene/build/classes/test-framework" /> <!-- include some lucene test code -->
- <pathelement path="${java.class.path}"/>
- </path>
-
- <target name="clean">
- <delete failonerror="false" dir="${dest}"/>
- </target>
-
- <target name="init">
- <mkdir dir="${dest}/classes"/>
- <mkdir dir="${build.javadoc}" />
- <subant target="compileTests">
- <fileset dir="${solr-path}" includes="build.xml"/>
- </subant>
- <subant target="make-manifest">
- <fileset dir="${solr-path}" includes="build.xml"/>
- </subant>
- </target>
-
- <target name="compile" depends="init">
- <solr-javac destdir="${dest}/classes"
- classpathref="common.classpath">
- <src path="src/main/java" />
- </solr-javac>
- </target>
-
- <target name="build" depends="compile">
- <solr-jar destfile="${dest}/${fullnamever}.jar" basedir="${dest}/classes"
- manifest="../../${dest}/META-INF/MANIFEST.MF">
- <fileset dir="src/main/resources" />
- </solr-jar>
- </target>
-
- <target name="compileTests" depends="compile">
- <solr-javac destdir="${dest}/test-classes"
- classpathref="test.classpath">
- <src path="src/test/java" />
- </solr-javac>
- <copy todir="${dest}/test-classes">
- <fileset dir="src/test/resources" excludes="**/*.java"/>
- </copy>
- </target>
-
- <property name="tempDir" value="${junit.output.dir}/temp" />
-
- <target name="test" depends="compileTests">
- <mkdir dir="${junit.output.dir}"/>
- <!-- <mkdir dir="@{tempDir}/@{pattern}"/>
- This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
- -->
- <touch file="${tempDir}/quiet.ant" verbose="false" mkdirs="true"/>
-
- <condition property="runall">
- <not>
- <or>
- <isset property="testcase"/>
- <isset property="testpackage"/>
- <isset property="testpackageroot"/>
- </or>
- </not>
- </condition>
-
- <junit printsummary="no"
- haltonfailure="no"
- maxmemory="512M"
- errorProperty="tests.failed"
- failureProperty="tests.failed"
- dir="${tempDir}"
- tempdir="${tempDir}"
- forkmode="perBatch"
- >
- <sysproperty key="java.util.logging.config.file" value="${common-solr.dir}/testlogging.properties"/>
- <sysproperty key="tests.luceneMatchVersion" value="${tests.luceneMatchVersion}"/>
- <sysproperty key="tests.codec" value="${tests.codec}"/>
- <sysproperty key="tests.locale" value="${tests.locale}"/>
- <sysproperty key="tests.timezone" value="${tests.timezone}"/>
- <sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
- <sysproperty key="tests.iter" value="${tests.iter}"/>
- <sysproperty key="tests.seed" value="${tests.seed}"/>
- <sysproperty key="jetty.insecurerandom" value="1"/>
- <sysproperty key="tempDir" file="${tempDir}"/>
- <sysproperty key="testmethod" value="${testmethod}"/>
- <jvmarg line="${args}"/>
- <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
- <classpath refid="test.classpath"/>
- <assertions>
- <enable package="org.apache.lucene"/>
- <enable package="org.apache.solr"/>
- </assertions>
- <formatter type="${junit.formatter}"/>
- <batchtest fork="yes" todir="${junit.output.dir}" if="runall">
- <fileset dir="src/test/java" includes="${junit.includes}"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
- <fileset dir="src/test/java" includes="**/${testcase}.java"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testpackage">
- <fileset dir="src/test/java" includes="**/${testpackage}/**/Test*.java,**/${testpackage}/**/*Test.java"/>
- </batchtest>
- <batchtest fork="yes" todir="${junit.output.dir}" if="testpackageroot">
- <fileset dir="src/test/java" includes="**/${testpackageroot}/Test*.java,**/${testpackageroot}/*Test.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="dist" depends="build">
- <copy file="build/${fullnamever}.jar" todir="${solr-path}/dist"/>
- </target>
-
- <target name="example" depends="build">
- <!-- :NOOP: this use to copy libs but now we can refer to them by path -->
- </target>
-
- <target name="javadoc">
- <sequential>
- <mkdir dir="${build.javadoc}/contrib-${name}"/>
-
- <path id="javadoc.classpath">
- <path refid="common.classpath"/>
- </path>
-
- <invoke-javadoc
- destdir="${build.javadoc}/contrib-${name}"
- title="${Name} ${version} contrib-${fullnamever} API">
- <sources>
- <packageset dir="src/main/java"/>
- </sources>
- </invoke-javadoc>
- </sequential>
- </target>
+ <property name="src.dir" location="src/main/java"/>
+ <property name="tests.src.dir" location="src/test/java"/>
+ <property name="tests.userdir" location="src/test/resources"/>
+ <import file="../contrib-build.xml"/>
</project>
diff --git a/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/src/test-framework/org/apache/solr/BaseDistributedSearchTestCase.java
similarity index 99%
rename from solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
rename to solr/src/test-framework/org/apache/solr/BaseDistributedSearchTestCase.java
index c32ccc52920..1ec2654a6e0 100644
--- a/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
+++ b/solr/src/test-framework/org/apache/solr/BaseDistributedSearchTestCase.java
@@ -150,7 +150,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
* (default is in test-files)
*/
public String getSolrHome() {
- return SolrTestCaseJ4.TEST_HOME;
+ return SolrTestCaseJ4.TEST_HOME();
}
@Override
diff --git a/solr/src/test/org/apache/solr/JSONTestUtil.java b/solr/src/test-framework/org/apache/solr/JSONTestUtil.java
similarity index 100%
rename from solr/src/test/org/apache/solr/JSONTestUtil.java
rename to solr/src/test-framework/org/apache/solr/JSONTestUtil.java
diff --git a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java b/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java
similarity index 96%
rename from solr/src/test/org/apache/solr/SolrTestCaseJ4.java
rename to solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java
index 546850a2666..da5d837af74 100755
--- a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java
@@ -86,7 +86,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
/** Call initCore in @BeforeClass to instantiate a solr core in your test class.
* deleteCore will be called for you via SolrTestCaseJ4 @AfterClass */
public static void initCore(String config, String schema) throws Exception {
- initCore(config, schema, TEST_HOME);
+ initCore(config, schema, TEST_HOME());
}
/** Call initCore in @BeforeClass to instantiate a solr core in your test class.
@@ -1057,22 +1057,8 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
}
}
- private static final String SOURCE_HOME = determineSourceHome();
- public static String TEST_HOME = getFile("solr/conf").getParent();
- public static String WEBAPP_HOME = new File(SOURCE_HOME, "src/webapp/web").getAbsolutePath();
- public static String EXAMPLE_HOME = new File(SOURCE_HOME, "example/solr").getAbsolutePath();
- public static String EXAMPLE_MULTICORE_HOME = new File(SOURCE_HOME, "example/multicore").getAbsolutePath();
- public static String EXAMPLE_SCHEMA=EXAMPLE_HOME+"/conf/schema.xml";
- public static String EXAMPLE_CONFIG=EXAMPLE_HOME+"/conf/solrconfig.xml";
-
- static String determineSourceHome() {
- // ugly, ugly hack to determine the example home without depending on the CWD
- // this is needed for example/multicore tests which reside outside the classpath
- File base = getFile("solr/conf/").getAbsoluteFile();
- while (!new File(base, "solr/CHANGES.txt").exists()) {
- base = base.getParentFile();
- }
- return new File(base, "solr/").getAbsolutePath();
+ public static String TEST_HOME() {
+ return getFile("solr/conf").getParent();
}
public static Throwable getRootCause(Throwable t) {
diff --git a/solr/src/test/org/apache/solr/analysis/BaseTokenTestCase.java b/solr/src/test-framework/org/apache/solr/analysis/BaseTokenTestCase.java
similarity index 100%
rename from solr/src/test/org/apache/solr/analysis/BaseTokenTestCase.java
rename to solr/src/test-framework/org/apache/solr/analysis/BaseTokenTestCase.java
diff --git a/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java b/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java
similarity index 99%
rename from solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java
rename to solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java
index 26aa2025b6a..e26cfda594c 100644
--- a/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java
+++ b/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java
@@ -90,7 +90,7 @@ public abstract class AbstractSolrTestCase extends LuceneTestCase {
* (default is in test-files)
*/
public String getSolrHome() {
- return SolrTestCaseJ4.TEST_HOME;
+ return SolrTestCaseJ4.TEST_HOME();
}
/**
diff --git a/solr/src/java/org/apache/solr/util/TestHarness.java b/solr/src/test-framework/org/apache/solr/util/TestHarness.java
similarity index 99%
rename from solr/src/java/org/apache/solr/util/TestHarness.java
rename to solr/src/test-framework/org/apache/solr/util/TestHarness.java
index ea5a703133c..4eee02b88cc 100644
--- a/solr/src/java/org/apache/solr/util/TestHarness.java
+++ b/solr/src/test-framework/org/apache/solr/util/TestHarness.java
@@ -61,7 +61,7 @@ import java.util.Map;
* writing testcases.
*
* <p>
- * This class lives in the main source tree (and not in the test source
+ * This class lives in the tests-framework source tree (and not in the test source
* tree), so that it will be included with even the most minimal solr
* distribution, in order to encourage plugin writers to create unit
* tests for their plugins.
diff --git a/solr/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java b/solr/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java
index 6ff054653c1..3c6b2d13c45 100644
--- a/solr/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java
+++ b/solr/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java
@@ -24,6 +24,7 @@ import org.apache.solr.client.solrj.request.UpdateRequest.ACTION;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrCore;
+import org.apache.solr.util.ExternalPaths;
/**
* Abstract base class for testing merge indexes command
@@ -37,7 +38,7 @@ public abstract class MergeIndexesExampleTestBase extends SolrExampleTestBase {
@Override
public String getSolrHome() {
- return SolrJettyTestBase.EXAMPLE_MULTICORE_HOME;
+ return ExternalPaths.EXAMPLE_MULTICORE_HOME;
}
@Override
diff --git a/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java b/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
index 6aa58516774..39fae68318b 100644
--- a/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
+++ b/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
@@ -25,6 +25,7 @@ import org.apache.solr.client.solrj.response.CoreAdminResponse;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrCore;
+import org.apache.solr.util.ExternalPaths;
/**
@@ -36,7 +37,7 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase
// protected static final CoreContainer cores = new CoreContainer();
protected static CoreContainer cores;
- @Override public String getSolrHome() { return SolrJettyTestBase.EXAMPLE_MULTICORE_HOME; }
+ @Override public String getSolrHome() { return ExternalPaths.EXAMPLE_MULTICORE_HOME; }
@Override public String getSchemaFile() { return getSolrHome()+"/core0/conf/schema.xml"; }
@Override public String getSolrConfigFile() { return getSolrHome()+"/core0/conf/solrconfig.xml"; }
diff --git a/solr/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java b/solr/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java
index 220c64c47b6..6baa3775570 100644
--- a/solr/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java
+++ b/solr/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java
@@ -22,6 +22,7 @@ import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.impl.BinaryRequestWriter;
import org.apache.solr.client.solrj.impl.BinaryResponseParser;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
+import org.apache.solr.util.ExternalPaths;
import org.junit.BeforeClass;
@@ -32,7 +33,7 @@ import org.junit.BeforeClass;
public class SolrExampleBinaryTest extends SolrExampleTests {
@BeforeClass
public static void beforeTest() throws Exception {
- createJetty(EXAMPLE_HOME, null, null);
+ createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
}
@Override
diff --git a/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java b/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java
index ad8a70aa299..4ca9a7511f3 100755
--- a/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java
+++ b/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java
@@ -24,6 +24,7 @@ import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
+import org.apache.solr.util.ExternalPaths;
import org.junit.AfterClass;
abstract public class SolrJettyTestBase extends SolrTestCaseJ4
@@ -32,7 +33,7 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4
// using configs in the test directory allows more flexibility to change "example"
// without breaking configs.
- public String getSolrHome() { return EXAMPLE_HOME; }
+ public String getSolrHome() { return ExternalPaths.EXAMPLE_HOME; }
public static JettySolrRunner jetty;
public static int port;
diff --git a/solr/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java b/solr/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java
index 9f5a4b50a31..69fb792a8e5 100644
--- a/solr/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java
+++ b/solr/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java
@@ -22,6 +22,7 @@ import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
import org.apache.solr.client.solrj.request.RequestWriter;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.util.ExternalPaths;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -38,7 +39,7 @@ public class TestBatchUpdate extends SolrJettyTestBase {
@BeforeClass
public static void beforeTest() throws Exception {
- createJetty(EXAMPLE_HOME, null, null);
+ createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
}
static final int numdocs = 1000;
diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java b/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
index cce5d3dae04..ab67aad3fc2 100644
--- a/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
+++ b/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
@@ -26,6 +26,7 @@ import org.apache.lucene.util.LuceneTestCase;
import org.apache.commons.io.IOUtils;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.SolrJettyTestBase;
+import org.apache.solr.util.ExternalPaths;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.bio.SocketConnector;
@@ -47,13 +48,13 @@ public class JettyWebappTest extends LuceneTestCase
public void setUp() throws Exception
{
super.setUp();
- System.setProperty("solr.solr.home", SolrJettyTestBase.EXAMPLE_HOME);
+ System.setProperty("solr.solr.home", ExternalPaths.EXAMPLE_HOME);
File dataDir = new File(SolrTestCaseJ4.TEMP_DIR,
getClass().getName() + "-" + System.currentTimeMillis());
dataDir.mkdirs();
System.setProperty("solr.data.dir", dataDir.getCanonicalPath());
- String path = SolrJettyTestBase.WEBAPP_HOME;
+ String path = ExternalPaths.WEBAPP_HOME;
server = new Server(port);
// insecure: only use for tests!!!!
diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeBinaryJettyTest.java b/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeBinaryJettyTest.java
index 69b13facb3c..0e4a507cd16 100644
--- a/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeBinaryJettyTest.java
+++ b/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeBinaryJettyTest.java
@@ -17,6 +17,7 @@
package org.apache.solr.client.solrj.embedded;
import org.apache.solr.client.solrj.LargeVolumeTestBase;
+import org.apache.solr.util.ExternalPaths;
import org.junit.BeforeClass;
/**
@@ -26,6 +27,6 @@ import org.junit.BeforeClass;
public class LargeVolumeBinaryJettyTest extends LargeVolumeTestBase {
@BeforeClass
public static void beforeTest() throws Exception {
- createJetty(EXAMPLE_HOME, null, null);
+ createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
}
}
diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeEmbeddedTest.java b/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeEmbeddedTest.java
index b72098a1c98..a01e6a7d29f 100644
--- a/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeEmbeddedTest.java
+++ b/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeEmbeddedTest.java
@@ -18,11 +18,12 @@
package org.apache.solr.client.solrj.embedded;
import org.apache.solr.client.solrj.LargeVolumeTestBase;
+import org.apache.solr.util.ExternalPaths;
import org.junit.BeforeClass;
public class LargeVolumeEmbeddedTest extends LargeVolumeTestBase {
@BeforeClass
public static void beforeTest() throws Exception {
- initCore(EXAMPLE_CONFIG, EXAMPLE_SCHEMA, EXAMPLE_HOME);
+ initCore(ExternalPaths.EXAMPLE_CONFIG, ExternalPaths.EXAMPLE_SCHEMA, ExternalPaths.EXAMPLE_HOME);
}
}
diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeJettyTest.java b/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeJettyTest.java
index 430316493cd..25040b06503 100644
--- a/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeJettyTest.java
+++ b/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeJettyTest.java
@@ -18,11 +18,12 @@
package org.apache.solr.client.solrj.embedded;
import org.apache.solr.client.solrj.LargeVolumeTestBase;
+import org.apache.solr.util.ExternalPaths;
import org.junit.BeforeClass;
public class LargeVolumeJettyTest extends LargeVolumeTestBase {
@BeforeClass
public static void beforeTest() throws Exception {
- createJetty(EXAMPLE_HOME, null, null);
+ createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
}
}
diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java b/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java
index 74839724d3d..6a569bc44d6 100644
--- a/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java
+++ b/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java
@@ -18,6 +18,7 @@
package org.apache.solr.client.solrj.embedded;
import org.apache.solr.client.solrj.SolrExampleTests;
+import org.apache.solr.util.ExternalPaths;
import org.junit.BeforeClass;
/**
@@ -30,6 +31,6 @@ public class SolrExampleEmbeddedTest extends SolrExampleTests {
@BeforeClass
public static void beforeTest() throws Exception {
- initCore(EXAMPLE_CONFIG, EXAMPLE_SCHEMA, EXAMPLE_HOME);
+ initCore(ExternalPaths.EXAMPLE_CONFIG, ExternalPaths.EXAMPLE_SCHEMA, ExternalPaths.EXAMPLE_HOME);
}
}
diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java b/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java
index b18605aae12..41bbaeb29e2 100644
--- a/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java
+++ b/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java
@@ -19,6 +19,7 @@ package org.apache.solr.client.solrj.embedded;
import org.apache.solr.client.solrj.SolrExampleTests;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
+import org.apache.solr.util.ExternalPaths;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -33,7 +34,7 @@ public class SolrExampleJettyTest extends SolrExampleTests {
@BeforeClass
public static void beforeTest() throws Exception {
- createJetty(EXAMPLE_HOME, null, null);
+ createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
}
@Test
diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java b/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
index 66e1ed0cd02..a7747d09be8 100644
--- a/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
+++ b/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
@@ -21,6 +21,7 @@ import org.apache.solr.client.solrj.SolrExampleTests;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
import org.apache.solr.client.solrj.impl.StreamingUpdateSolrServer;
+import org.apache.solr.util.ExternalPaths;
import org.junit.BeforeClass;
@@ -32,7 +33,7 @@ import org.junit.BeforeClass;
public class SolrExampleStreamingTest extends SolrExampleTests {
@BeforeClass
public static void beforeTest() throws Exception {
- createJetty(EXAMPLE_HOME, null, null);
+ createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
}
@Override
diff --git a/solr/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java b/solr/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java
index 5e0eed5313b..4a599f0b1b4 100644
--- a/solr/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java
+++ b/solr/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java
@@ -24,6 +24,7 @@ import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.response.TermsResponse.Term;
+import org.apache.solr.util.ExternalPaths;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -35,7 +36,7 @@ public class TermsResponseTest extends SolrJettyTestBase {
@BeforeClass
public static void beforeTest() throws Exception {
- initCore(EXAMPLE_CONFIG, EXAMPLE_SCHEMA, EXAMPLE_HOME);
+ initCore(ExternalPaths.EXAMPLE_CONFIG, ExternalPaths.EXAMPLE_SCHEMA, ExternalPaths.EXAMPLE_HOME);
}
@Before
diff --git a/solr/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java b/solr/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java
index ff789f5088e..646d8bca727 100644
--- a/solr/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java
+++ b/solr/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java
@@ -25,6 +25,7 @@ import org.apache.solr.client.solrj.response.SpellCheckResponse.Correction;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SpellingParams;
+import org.apache.solr.util.ExternalPaths;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -40,7 +41,7 @@ public class TestSpellCheckResponse extends SolrJettyTestBase {
@BeforeClass
public static void beforeTest() throws Exception {
// createJetty(EXAMPLE_HOME, null, null);
- initCore(EXAMPLE_CONFIG, EXAMPLE_SCHEMA, EXAMPLE_HOME);
+ initCore(ExternalPaths.EXAMPLE_CONFIG, ExternalPaths.EXAMPLE_SCHEMA, ExternalPaths.EXAMPLE_HOME);
// initCore("solrconfig.xml", "schema.xml", null);
}
diff --git a/solr/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java b/solr/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
index 2452a90f498..23b420c2aae 100644
--- a/solr/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
+++ b/solr/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
@@ -60,7 +60,7 @@ public class BasicDistributedZkTest extends AbstractDistributedZkTestCase {
@BeforeClass
public static void beforeClass() throws Exception {
- System.setProperty("solr.solr.home", SolrTestCaseJ4.TEST_HOME);
+ System.setProperty("solr.solr.home", SolrTestCaseJ4.TEST_HOME());
}
@Override
diff --git a/solr/src/test/org/apache/solr/common/util/TestSystemIdResolver.java b/solr/src/test/org/apache/solr/common/util/TestSystemIdResolver.java
index a827db9f97b..d8ffdebfaf8 100644
--- a/solr/src/test/org/apache/solr/common/util/TestSystemIdResolver.java
+++ b/solr/src/test/org/apache/solr/common/util/TestSystemIdResolver.java
@@ -38,9 +38,9 @@ public class TestSystemIdResolver extends LuceneTestCase {
}
public void testResolving() throws Exception {
- final ResourceLoader loader = new SolrResourceLoader(SolrTestCaseJ4.TEST_HOME, this.getClass().getClassLoader());
+ final ResourceLoader loader = new SolrResourceLoader(SolrTestCaseJ4.TEST_HOME(), this.getClass().getClassLoader());
final SystemIdResolver resolver = new SystemIdResolver(loader);
- final String fileUri = new File(SolrTestCaseJ4.TEST_HOME+"/crazy-path-to-config.xml").toURI().toASCIIString();
+ final String fileUri = new File(SolrTestCaseJ4.TEST_HOME()+"/crazy-path-to-config.xml").toURI().toASCIIString();
assertEquals("solrres:/test.xml", SystemIdResolver.createSystemIdFromResourceName("test.xml"));
assertEquals("solrres://@/usr/local/etc/test.xml", SystemIdResolver.createSystemIdFromResourceName("/usr/local/etc/test.xml"));
@@ -60,10 +60,10 @@ public class TestSystemIdResolver extends LuceneTestCase {
assertEntityResolving(resolver, "solrres:/schema.xml", "solrres:/solrconfig.xml", "schema.xml");
assertEntityResolving(resolver, "solrres:/org/apache/solr/common/util/TestSystemIdResolver.class",
"solrres:/org/apache/solr/common/ResourceLoader.class", "util/TestSystemIdResolver.class");
- assertEntityResolving(resolver, SystemIdResolver.createSystemIdFromResourceName(SolrTestCaseJ4.TEST_HOME+"/conf/schema.xml"),
- SystemIdResolver.createSystemIdFromResourceName(SolrTestCaseJ4.TEST_HOME+"/conf/solrconfig.xml"), "schema.xml");
- assertEntityResolving(resolver, SystemIdResolver.createSystemIdFromResourceName(SolrTestCaseJ4.TEST_HOME+"/crazy-path-to-schema.xml"),
- SystemIdResolver.createSystemIdFromResourceName(SolrTestCaseJ4.TEST_HOME+"/crazy-path-to-config.xml"), "crazy-path-to-schema.xml");
+ assertEntityResolving(resolver, SystemIdResolver.createSystemIdFromResourceName(SolrTestCaseJ4.TEST_HOME()+"/conf/schema.xml"),
+ SystemIdResolver.createSystemIdFromResourceName(SolrTestCaseJ4.TEST_HOME()+"/conf/solrconfig.xml"), "schema.xml");
+ assertEntityResolving(resolver, SystemIdResolver.createSystemIdFromResourceName(SolrTestCaseJ4.TEST_HOME()+"/crazy-path-to-schema.xml"),
+ SystemIdResolver.createSystemIdFromResourceName(SolrTestCaseJ4.TEST_HOME()+"/crazy-path-to-config.xml"), "crazy-path-to-schema.xml");
// test, that resolving works if somebody uses an absolute file:-URI in a href attribute, the resolver should return null (default fallback)
assertNull(resolver.resolveEntity(null, null, "solrres:/solrconfig.xml", fileUri));
diff --git a/solr/src/test/org/apache/solr/servlet/NoCacheHeaderTest.java b/solr/src/test/org/apache/solr/servlet/NoCacheHeaderTest.java
index e1d5bc696e0..ee360bf2f9e 100644
--- a/solr/src/test/org/apache/solr/servlet/NoCacheHeaderTest.java
+++ b/solr/src/test/org/apache/solr/servlet/NoCacheHeaderTest.java
@@ -31,7 +31,7 @@ import org.junit.Test;
public class NoCacheHeaderTest extends CacheHeaderTestBase {
@BeforeClass
public static void beforeTest() throws Exception {
- createJetty(TEST_HOME, "solr/conf/solrconfig-nocache.xml", null);
+ createJetty(TEST_HOME(), "solr/conf/solrconfig-nocache.xml", null);
}
// The tests
diff --git a/solr/src/test/org/apache/solr/spelling/suggest/PersistenceTest.java b/solr/src/test/org/apache/solr/spelling/suggest/PersistenceTest.java
index 4e4c899b1aa..58997c5730e 100644
--- a/solr/src/test/org/apache/solr/spelling/suggest/PersistenceTest.java
+++ b/solr/src/test/org/apache/solr/spelling/suggest/PersistenceTest.java
@@ -49,7 +49,7 @@ public class PersistenceTest extends SolrTestCaseJ4 {
for (String k : keys) {
lookup.add(k, new Float(k.length()));
}
- File storeDir = new File(TEST_HOME);
+ File storeDir = new File(TEST_HOME());
lookup.store(storeDir);
lookup = new TSTLookup();
lookup.load(storeDir);
@@ -66,7 +66,7 @@ public class PersistenceTest extends SolrTestCaseJ4 {
for (String k : keys) {
lookup.add(k, new Float(k.length()));
}
- File storeDir = new File(TEST_HOME);
+ File storeDir = new File(TEST_HOME());
lookup.store(storeDir);
lookup = new JaspellLookup();
lookup.load(storeDir);
diff --git a/solr/src/test/org/apache/solr/util/ExternalPaths.java b/solr/src/test/org/apache/solr/util/ExternalPaths.java
new file mode 100644
index 00000000000..9ea244c6773
--- /dev/null
+++ b/solr/src/test/org/apache/solr/util/ExternalPaths.java
@@ -0,0 +1,46 @@
+package org.apache.solr.util;
+
+/**
+ * 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.
+ */
+
+import java.io.File;
+
+import org.apache.solr.SolrTestCaseJ4;
+
+/**
+ * Some tests need to reach outside the classpath to get certain resources (e.g. the example configuration).
+ * This class provides some paths to allow them to do this.
+ * @lucene.internal
+ */
+public class ExternalPaths {
+ private static final String SOURCE_HOME = determineSourceHome();
+ public static String WEBAPP_HOME = new File(SOURCE_HOME, "src/webapp/web").getAbsolutePath();
+ public static String EXAMPLE_HOME = new File(SOURCE_HOME, "example/solr").getAbsolutePath();
+ public static String EXAMPLE_MULTICORE_HOME = new File(SOURCE_HOME, "example/multicore").getAbsolutePath();
+ public static String EXAMPLE_SCHEMA=EXAMPLE_HOME+"/conf/schema.xml";
+ public static String EXAMPLE_CONFIG=EXAMPLE_HOME+"/conf/solrconfig.xml";
+
+ static String determineSourceHome() {
+ // ugly, ugly hack to determine the example home without depending on the CWD
+ // this is needed for example/multicore tests which reside outside the classpath
+ File base = SolrTestCaseJ4.getFile("solr/conf").getAbsoluteFile();
+ while (!new File(base, "solr/CHANGES.txt").exists()) {
+ base = base.getParentFile();
+ }
+ return new File(base, "solr/").getAbsolutePath();
+ }
+}