You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Adam Flegman <ad...@astracon.com.au> on 2001/05/11 03:42:11 UTC

Classpath not present problem

Hello,


I'm having some trouble with a classpath declaration.


The format of my make file is load properties, declared patternsets, then
create path entries (some of which are based on properties whilst others are
based on patternsets).


The offending path declaration is listed below:

<!-- Orbix -->
<path id="orbix.classpath">
     <fileset dir="${output.vc.lib.dir}">
        <patternset refid="orbix.files"/>
    </fileset>
</path>


I think the line of code failing is the <fileset dir="...." command. The
directory it is referring to isnt actually in existence at the begining of
the whole process, but rather it gets created as a result of a cvs checkout.

The orbix.files pattern set is only 3 jars so I suppose i could do something
like the following but was wondering if there was a more elegant way to
address this:
<!-- Orbix -->
<path id="orbix.classpath">
    <pathelement location="${output.vc.lib.dir}">/cm.orbix2000.jar"/>
    <pathelement location="${output.vc.lib.dir}">/omg.jar"/>
    <pathelement location="${output.vc.lib.dir}">/orbix2000.jar"/>
</path>



Cheers,

          Ad.

==========================================================
Adam Flegman - Senior Software Engineer
Astracon (Australia) Pty Ltd
Email:  adam.flegman@astracon.com.au
Phone: (07) 3368 6979,  DID: +617 3368 6979
Fax: (07) 3368 6999
PO Box 1656,
Milton   4064,
Australia.
==========================================================


Re: Classpath not present problem

Posted by Stefan Bodewig <bo...@apache.org>.
Adam Flegman <ad...@astracon.com.au> wrote:

> I think the line of code failing is the <fileset dir="...."
> command. The directory it is referring to isnt actually in existence
> at the begining of the whole process, but rather it gets created as
> a result of a cvs checkout.

This has been fixed to a certain extend in Ant 1.4alpha, as fileset
will not try to assert the directory's presence before it actually
gets used for the first time.  Unfortunately, this is not going to
help in your case, as the path construct is going to expand the
fileset immediately.

A workaround would be to not declare the path at the project level,
but spell it out at the point where you use it for the first time, so
instead of

<path id="orbix.classpath">
  <fileset dir="${output.vc.lib.dir}">
    <patternset refid="orbix.files"/>
  </fileset>
</path>

<target ...>
  <javac ...>
    <classpath refid="orbix.classpath" />
  </javac>
  <rmic ...>
    <classpath refid="orbix.classpath" />
  </rmic>
</target>

do something like

<target ...>
  <javac ...>
    <classpath id="orbix.classpath">
      <fileset dir="${output.vc.lib.dir}">
        <patternset refid="orbix.files"/>
      </fileset>
    </classpath>
  </javac>
  <rmic ...>
    <classpath refid="orbix.classpath" />
  </rmic>
</target>

Stefan