That's the only way to do it if you neither move that file in ${WEB_SOURCE}
directly, nor make it part of package com.projectwise.web.client.base (and
it stays where it is). ANT by design assumes Sources are in directories
consistent with package names. Assuming it's your 'main' class, by having it
in the 'unnamed' package, you save a little typing, but better yet, run off
a JAR which had it's Main-Class: attribute properly set in its manifest (set
the Class-Path: one while you're at it ;-)

And FWIW, get in the habit of using forward-slashes in all your ANT build
files ;-) --DD

-----Original Message-----
From: Robert Priest [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, May 22, 2002 1:56 PM
To: 'Ant Users List'
Subject: RE: Entire source compiling EVERY time

Thanks Jon. I think I understand now.But I have another question (more about
style I guess):

I have a file under "com\projectwise\web\client\base" called
PWClientStarter.java. That is still getting compiled everytime.
Now I changed my target to look like:

<target name="com" depends="prepare">
    <javac srcdir="${WEB_SOURCE}" destdir="${WEB_OUT}"
     includes="com\**"
     excludes="com\projectwise\web\client\pwviewer\**"
     listfiles="yes"
     />
   </target>

which works fine for everything except this one particular file. 
Now that one file does not have a "package" line. 
Is that what causes it to be compiled everytime? 

I was able to rectify it by doing a:

 <target name="com" depends="prepare">
    <javac srcdir="${WEB_SOURCE}" destdir="${WEB_OUT}"
     includes="com\**"
 
excludes="com\projectwise\web\client\pwviewer\**,com\projectwise\web\client\
base\PWClientStarter.java"
     listfiles="yes"
     />
     <javac srcdir="${WEB_SOURCE}\com\projectwise\web\client\base"
destdir="${WEB_OUT}"
     includes="PWClientStarter.java"
     listfiles="yes"
     />
   </target>


Is that the most elegant way of doing this, or is there a better way?



-----Original Message-----
From: Jon Skeet [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 22, 2002 1:40 PM
To: Ant Users List
Subject: RE: Entire source compiling EVERY time


> Here is my what my target looks like:
> 
>  <target name="compile" depends="prepare">
>     <javac srcdir="${WEB_SOURCE}\com\projectwise\web\common"
> destdir="${WEB_OUT}" />
>     <javac srcdir="${WEB_SOURCE}\com\projectwise\web\server"
> destdir="${WEB_OUT}" />
>     <javac srcdir="${WEB_SOURCE}\com\projectwise\web\client"
> destdir="${WEB_OUT}" 
>      excludes="pwviewer\**"
>      />
>    </target>

That's your problem - you should be using:

<javac srcdir="${WEB_SOURCE}" destdir="${WEB_OUT}" />

and using a filter to get only those directories if that's all you want -
otherwise javac thinks that the srcdir value is the *root* of your package
tree.

Jon

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to