ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: null path references & javac
Date Wed, 02 Jun 2004 18:02:36 GMT
> From: Shackelford, John-Mason [mailto:john-mason.shackelford@pearson.com]
> 
> Another angle on the problem...
> 
> I pass the following classpath to the javac task, yet the
> dependencies.classpath reference may or may not exist as the reference is
> generated by another task which may not set it if no dependencies are
> identified.
> 
> <classpath id="component.classpath">
>      <fileset dir="lib" includes="*.jar,*.zip" />
>      <path refid="dependencies.classpath" />
> </classpath>
> 
> When the reference isn't set, javac dies. We don't seem to have a concept
> of a legitimately null path reference, so I have to resort to a
> conditional and two different javac calls. Is there another way around
> this problem?

Rather than duplicating your javac call, you could define an empty classpath
using that same id!? I have to confess though that I've created a
conditional path to deal with similar issues... It may not deal with this
particular issue, but probably could.

This is why I say that conditions are natural in builds, but should be
available anywhere in the build. Imagine either:

<classpath id="component.classpath">
     <fileset dir="lib" includes="*.jar,*.zip" />
     <path refid="dependencies.classpath" failOnNotFound="false" />
</classpath>

or 

<condition property="use-dependency">
  <isreference refid="dependencies.classpath" type="path" />
</condition>

<classpath id="component.classpath">
     <fileset dir="lib" includes="*.jar,*.zip" />
     <path refid="dependencies.classpath" if="use-dependencies" />
</classpath>

Not much help for you at this point though. Sorry, --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message