Forums Register Login

Opinion on this build.xml file I wrote

+Pie Number of slices to send: Send
project name="Guest Book" default="build" basedir=".">

<target name="build" >

<javac srcdir="C:\apache-tomcat-6.0.10\webapps\Guest Book\WEB-INF\classes"
destdir="C:\apache-tomcat-6.0.10\webapps\Guest Book\WEB-INF\classes"
classpath="C:\apache-tomcat-6.0.10\lib\servlet-api.jar" debug="true" includes="**/*.java"/>
</target>

</project>

What do you all think of this? Please suggest better ways of writing the same.
+Pie Number of slices to send: Send
How about



You could even keep the tomcatDir and servletLib properties in a global property file, since they are likely to be used in other build files as well. That way you only need to change them in a single location if necessary.
[ May 16, 2007: Message edited by: Ulf Dittmer ]
+Pie Number of slices to send: Send
1. I prefer to declare paths in property tags.
For example , one for the path to the root of the application (C:\apache-tomcat-6.0.10\webapps\Guest Book), one for the source (reusing the previous property), one for the destination, one for external libraries.
<property name="app.root" value="C:\apache-tomcat-6.0.10\webapps\Guest Book" />
<property name="app.src" value="..." />
<property name="app.classes" value="${app.root}\WEB-INF\classes" />

2. It's not an Ant related, but I would not put source files in the classes directory
+Pie Number of slices to send: Send
 


<property name="servletLib" value="${tomcatDir}\lib\servlet-api.jar">


Can I use this like :
<property name="servletLib" value="${tomcatDir}\lib\" includes ="*.jar"> ???

Like, I am thinking if there is a situation where multiple jar files need to be used?
+Pie Number of slices to send: Send
I think this should cover all the bases:

[ May 16, 2007: Message edited by: Ulf Dittmer ]
+Pie Number of slices to send: Send
 

<property name="tomcatDir" value="C:\apache-tomcat-6.0.10\">

<property name="servletLib" value="${tomcatDir}\lib\servlet-api.jar">

<property name="webAppDir" value="${tomcatDir}\webapps\Guest Book">

<property name="classDir" value="${webAppDir}\WEB-INF\classes">

<path id="class.path">
<fileset dir="${webAppDir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${servletLib}" />
</path>



I am thinking, why do we need the path element when we already have specified all the jar files in the fileset dir?
Using servletLib, we are still pointed to servlet-api.jar right? or is that how it is done, we point to all the jar files we need to add one by one and those will be the path elements??
+Pie Number of slices to send: Send
A path can contain any number of filesets and pathelements, so yes, this is necessary. These concepts are explained in detail with many examples in the Ant manual.
+Pie Number of slices to send: Send
Yes, I got it, thank you so much for clearing all my doubts!
+Pie Number of slices to send: Send
Hi Ulf,
Where is the Ant Manual available?
With regards,
Padma priya N.G.
What's gotten into you? Could it be this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1195 times.
Similar Threads
Cant compile the struts application withEclispse 3.4
/hibernate.cfg.xml not found
java.lang.VerifyError:
build.xml ... what am I doing wrong?
Spring 3.x + ant 1.7.x Build problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 08:30:43.