ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eddie Bernard <>
Subject RE: doing a build with multiple directories
Date Thu, 07 Feb 2002 07:44:52 GMT
I assume that Project is at a higher level than client (couldn't tell from
the indentation provided ;) ).

Anyway, to take care of the error associated with the missing APIs, you need
to add the following (of course, others could recommend other ways, but this
is how I'd do it):

<property name="your.api" value="path_to_your_API/API.jar"
<target name="build" depends="init">
 <javac srcdir="${Src}"  destdir="${Dest}"

The <javac> task using ${Src} as its root, walk down the directory structure
finding *.java, compiling it, and copying the associated *.class files to
the ${Dest} directory.

If you have others APIs, you may want to add it to the classpath.  I also
imagine that there is a dependency on each java file, so your classpath
attribute might be:


You should add all the pertinent APIs (jar, zip, etc.) to this classpath as

Personally, as a matter of style and in the interest of separating
properties from the "source" (i.e., build.xml) I place all properties in a
.properties file and import them using the following:

<property file=""/>

Again, take a look at the Ant docs for more information.


-----Original Message-----
From: Rosemarie Hannan (Financial IQ) []
Sent: Wednesday, February 06, 2002 11:22 PM
Subject: RE: doing a build with multiple directories


This what I have currently done, and as I am new to Ant any help would be

Directory looks as follows:
  ---> Workflow
    ---> SharedComponent
       ---> SourceCode
         ---> Project
	---> client
		--> shared
		         --> beans
		         --> rmiClient
		--> stdeimage
		         --> images
		         --> resources
	---> Server
		--> shared
		        --> approx. 12 sub directories

	---> Shared
		--> beans
		--> storage
		--> interfaces

Currently this is what my build file looks like :
<!-- Build file for ContentIQ-SharedComponents -->
<project name="SharedComponent" default="copy" basedir=".">
<!-- ========================================= -->
<!-- initialise the variables -->
<!-- ========================================= -->
<target name="init">
 <property name="jardir"
 <property name="Src"
 <property name="Dest"
<!-- ========================================= -->
<!-- Building the files -->
<!-- ========================================= -->
<target name="build" depends="init">
 <javac srcdir="${Src}"  destdir="${Dest}" />
 <!-- ========================================= -->
 <!-- creating the jar files -->
 <!-- ========================================= -->
 <target name="jar" depends="build">
  <jar jarfile="Workflow.jar" basedir="${Dest}"/>
  <jar jarfile="WorkflowSrc.jar" basedir="${Src}"/>
 <!-- ======================================== -->
 <!-- Copying files to release dir -->
 <!-- ======================================== -->
 <target name="copy" depends="jar">
 <copy todir="${jardir}">
 <fileset dir="${basedir}" includes="*.jar"/>

I included the additional jar file pw.jar to my classpath in the
environment, so that it would see it
Errors all refer to classes not being able to reference certain items, but
then why does this work with Forte and not with the build file.
There are approx. 100 errors.

-----Original Message-----
From: Diane Holt []
Sent: Thursday, February 07, 2002 8:54 AM
To: Ant Users List
Subject: Re: doing a build with multiple directories

--- "Rosemarie Hannan (Financial IQ)" <> wrote:
> I am trying to do a build that will compile multilpe classes which sit
> in multple directories, jar them and then copy them to a release
> directory so that it is ready for deployment. How do I do this? - as I
> have tired listing each one of the folders separately or alternatively
> list each main folder and include the sub directories via the "includes"
> command, but I have not had much success.

Since what you are trying to do is the most basic type of process for Ant
to be used for, you'll need to include a bit more information than just
saying you've "not had much success". In what way doesn't it succeed for

If you want all your subdirectories included in the compile, from a single
target within a single top-level buildfile, you shouldn't need to list any
of them, but simply point 'srcdir' to the directory where your package
hierarchy starts.

> I also need the classes in the directories to reference
> another jar file that contain api.

See the Javac task description in the manual for information on adding
classpath elements.



Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message