Solr Developers,

I'm unable to successfully run the v1.1.0 Ant build.xml's compile target (on which the dist target depends), because JUnit isn't in the classpath. I note that at least one other solr user has apparently run into the same problem (see <http://www.mail-archive.com/[email protected]/msg01004.html> for details).

The build.xml's compile target uses the compile.classpath path, which doesn't include any JUnit JARs (note that ${lib} here refers to the lib directory within the solr project itself, which doesn't contain a JUnit JAR either):

  <path id="compile.classpath">
    <fileset dir="${lib}">
      <include name="*.jar" />
    </fileset>
  </path>

The problem is that org.apache.solr.util.AbstractSolrTestCase imports junit.framework.TestCase, so when the compile target tries to compile it (along with all other .java files inside src/java/), this JUnit package isn't in the classpath, so I get the following error:

Buildfile: /Users/schmed/Projects/Krugle/solr-base/build.xml
compile:
    [mkdir] Created dir: /Users/schmed/Projects/Krugle/solr-base/build
[javac] Compiling 155 source files to /Users/schmed/Projects/Krugle/solr-base/build [javac] /Users/schmed/Projects/Krugle/solr-base/src/java/org/apache/solr/util/AbstractSolrTestCase.java:25: package junit.framework does not exist
    [javac] import junit.framework.TestCase;
    [javac] ^
[javac] /Users/schmed/Projects/Krugle/solr-base/src/java/org/apache/solr/util/AbstractSolrTestCase.java:44: cannot find symbol

I note that when solr first started using JUnit, others apparently ran into this missing classpath entry problem when building the javadoc target, and I see rather elaborate handling of this (essentially getting the JUnit JAR from the Ant Library folder) in the build.xml for that target's special javadoc.classpath path:

    <path id="javadoc.classpath">
       <path refid="compile.classpath"/>
       <!-- aparently ant.library.dir isn't allways set right? -->
       <fileset dir="${ant.home}/lib">
          <include name="**/*.jar"/>
       </fileset>
       <fileset dir="${ant.library.dir}">
          <include name="**/*.jar"/>
       </fileset>
    </path>

I'm puzzled why the same isn't true for the compile target.

Any help would be greatly appreciated.

Thanks,

- Chris

--
----------------------------
Chris Schneider
Krugle, Inc.
http://www.krugle.com
----------------------------

Reply via email to