ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eddie Bernard <ebern...@digitalthink.com>
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}"
        classpath="${your.api}"/>
 </target>

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:

        classpath="${Dest};${your.api}${another.api};"

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

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="my_properties.properties"/>

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


Cheers!
Eddie


-----Original Message-----
From: Rosemarie Hannan (Financial IQ) [mailto:RosemarieH@fin-soft.co.za]
Sent: Wednesday, February 06, 2002 11:22 PM
To: ant-user@jakarta.apache.org
Subject: RE: doing a build with multiple directories


hi

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

Directory looks as follows:
***************************************************
ContentIQ
  ---> 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"
value="c:\ContentIQ\Workflow\SharedComponent\SourceCode\Project.jar"/>
 <property name="Src"
value="c:\ContentIQ\Workflow\SharedComponent\SourceCode\Project\"/>
 <property name="Dest"
value="c:\ContentIQ\Workflow\SharedComponent\SourceCode\Project\classes"/>
</target>
<!-- ========================================= -->
<!-- Building the files -->
<!-- ========================================= -->
<target name="build" depends="init">
 <javac srcdir="${Src}"  destdir="${Dest}" />
 </target>
 <!-- ========================================= -->
 <!-- creating the jar files -->
 <!-- ========================================= -->
 <target name="jar" depends="build">
  <jar jarfile="Workflow.jar" basedir="${Dest}"/>
  <jar jarfile="WorkflowSrc.jar" basedir="${Src}"/>
 </target>
 <!-- ======================================== -->
 <!-- Copying files to release dir -->
 <!-- ======================================== -->
 <target name="copy" depends="jar">
 <copy todir="${jardir}">
 <fileset dir="${basedir}" includes="*.jar"/>
 </copy>
 </target>
 </project>

I included the additional jar file pw.jar to my classpath in the
environment, so that it would see it
Thanks
rose
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 [mailto:holtdl@yahoo.com]
Sent: Thursday, February 07, 2002 8:54 AM
To: Ant Users List
Subject: Re: doing a build with multiple directories


--- "Rosemarie Hannan (Financial IQ)" <RosemarieH@fin-soft.co.za> 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
you?

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.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
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