ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: classpath
Date Wed, 24 Jul 2002 00:15:48 GMT
Correcting a few typos, and wanted to point out that using root ('/') as the
fileset 'dir' attribute makes Ant scan your entire file-system... The
approach below should make your build faster, and solve your <javac> issue
(although Diane already solve that one). --DD

-----Original Message-----
From: Dominique Devienne [mailto:DDevienne@lgc.com] 
Sent: Tuesday, July 23, 2002 7:12 PM
To: 'Ant Users List'
Subject: RE: classpath

I'd advise you to do instead:

  <property name="classDir" value="classes"/>
  <property name="repastDir" value="/appl/repast/repast1.4.1"/>
  <property name="cscslibDir" value="/appl/java/CSCS"/> 
  <property name="visadDir" value="/appl/java/visad2.0"/>

  <fileset id="repast.jars" dir="${repastDir}/lib">
    <include name="repast.jar"/>
    <include name="colt.jar"/>   
    <include name="jgl3.1.0.jar"/>
  </fileset>

  <fileset id="cscs.jars" dir="${cscslibDir}/>
    <include name="graph3d.jar"/>
    <include name="ioutils.jar"/>
    <include name="hbbeta2-printf.jar"/>
    <include name="Test/modelparameters.jar"/>
  </fileset>

  <fileset id="visa.jars" dir="${visadDir}">
    <include name="visad.jar"/>
  </fileset>

  <fileset id="classes" dir="${classDir}" />

Unfortunally, you cannot do:

  <fileset id="classpath.fileset">
    <fileset refid="repast.jars"/>
    <fileset refid="cscs.jars"/>
    <fileset refid="visa.jars"/>
  </fileset>

But you can do:

  <path id="classpath">
    <fileset refid="repast.jars"/>
    <fileset refid="cscs.jars"/>
    <fileset refid="visa.jars"/>
    <pathelement location="${classDir}"/>
  </fileset>

which you can then use in <javac> and <java> as:

  <classpath refid="classpath"/>

When you want to do the copy, you do:

  <copy todir="...">
    <fileset refid="repast.jars"/>
    <fileset refid="cscs.jars"/>
    <fileset refid="visa.jars"/>
    <fileset dir="${classDir}"/>
  </copy>

Let me know if this works for you. --DD

-----Original Message-----
From: Mike Charters [mailto:mcharter@umich.edu] 
Sent: Tuesday, July 23, 2002 7:01 PM
To: ant-user@jakarta.apache.org
Subject: classpath

hi,

i would like to define some kind of datatype with a list of all the
library jarfiles that my project includes.

i would like to be able to reference this same datatype a few times in
my build file ... for the classpath of a javac task, for the classpath
of a java task, and for the source files of a copy task.

because the copy task only takes filesets, filtersets, and mappersets i
decided a fileset would probably be the best bet.

this is how i defined my fileset at the beginning of the build.xml file:

  <property name="classDir" value="classes"/>
  <property name="repastDir" value="/appl/repast/repast1.4.1"/>
  <property name="cscslibDir" value="/appl/java/CSCS"/> 
  <property name="visadDir" value="/appl/java/visad2.0"/>

  <fileset id="classpath.fileset" dir="/">
    <include name="${repastDir}/lib/repast.jar"/>
    <include name="${repastDir}/lib/colt.jar"/>   
    <include name="${repastDir}/lib/jgl3.1.0.jar"/>
    <include name="${cscslibDir}/graph3d.jar"/>
    <include name="${cscslibDir}/ioutils.jar"/>
    <include name="${cscslibDir}/hbbeta2-printf.jar"/>
    <include name="${cscslibDir}/Test/modelparameters.jar"/>
    <include name="${visadDir}/visad.jar"/>
    <include name="${classDir}"/>
  </fileset>

i have the dir as "/" because the files are all over the system ... so i
need to reference them with respect to the root dir (this is for the
development version only, the dist versions will come with all these
libs in a built-in lib dir so that the program is "flexible" with
respect to being able to copy it to other machines easily)

my javac task looks like this:

    <javac destdir="${classDir}">
      <src path="${srcDir}"/>
      <include name="${currentLS}/*.java"/>
      <classpath>
        <fileset refid="classpath.fileset"/>
      </classpath>
    </javac>

when i call the target that calls this javac task ant prints out all the
error messages from javac ... and for some reason it just looks like
javac cannot find any of the libraries ... (it just says package XXX
does not exist 100 times")

does anyone know what i am doing wrong ... or have another suggestion of
a better datatype for storing the classpath so it is flexible...

what do people normally store the classpath in?

thanks a lot,

-Mike


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

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

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


Mime
View raw message