ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shorn Tolley" <shorn_tol...@hotmail.com>
Subject Re: How do I debug what's in a path?
Date Sun, 02 Jun 2002 15:07:03 GMT
Ok,

I've got my little test app breaking at the command line now, just like
NetBeans.
(So now I think the problem is Ant again)

The problem has to do with the combination of having a package on the system
classpath, having build.sysclasspath=ignore set and using the available
task.

So, here's the setup.  (I have a minimal test app that demonstrates this,
which I can send to you in a jar if you like).

On my classpath, I have <things needed for Ant to run>;lib/regexp.jar
But, I have specified build.sysclasspath=ignore, so that regexp.jar on the
system classpath should be ignored during Ant processing right?

We have a path that looks like this:
  <path id="test.classpath">
  </path>
Which should (and does) result in a completely empty classpath.

Then, we have a task that looks like this:
    <available property="regexp.present"
               classname="org.apache.regexp.RE"
               classpathref="test.classpath" />

This is supposed to search for the RE class *only* on the 'test.classpath',
right?
This, I think is where the problem is, because it looks like the 'available'
task is looking for this class on the system class path (because the
regexp.present property *is* being set).

Then, we have a compile target that looks like this:
  <target name="compile" depends="prepare">
    <echo message="regexp.present=${regexp.present}"/>
    <javac srcdir="${src.dir}"
           destdir="${build.dir}"
           debug="on" >
      <classpath refid="test.classpath" />
      <exclude name="RETest.java" unless="regexp.present" />
    </javac>
  </target>

The javac task *is* working right, because it is only looking on the
classpath defined by 'test.classpath' for the class, and consequently
breaking because the RE class isn't on that classpath, it's on the system
classpath (which is being ignored because of the 'build.sysclasspath'
setting).

So, in summary to the confusing mess above (sorry, I'm not a writer), I
think the available task is looking on the system classpath as well as the
classpath it is being given.  I dunno, maybe it's supposed to be doing that?
(if so, then the either Ant build file is wrong, or the 'javac' task should
also exhibit this behaviour)

If anyone can confirm that this *is* wrong behaviour, then I will go an
track down the problem in Available.java.

Shorn.

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message