You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Yadav, Akshat Kumar " <ak...@citi.com> on 2007/06/26 10:15:16 UTC

Javac task query

Hi All,

Ant manual says "The source and destination directory will be
recursively scanned for Java source files to compile. Only Java files
that have no corresponding .class file or where the class file is older
than the .java file will be compiled."

Reference: http://ant.apache.org/manual/CoreTasks/javac.html

But, when I compile my java files through using ANT javav task, all
files gets compiled every time. Rather, I want it to compile only those
files that have no corresponding .class file or where the class file is
older than the .java file. 

Code:

	<target name="compile">
		<javac srcdir="${src}" destdir="${dest}"
deprecation="no" debug="on" listfiles="yes">
				<classpath>
					<fileset dir="${lib}"
includes="**/*.jar **/*.zip"/>
					<fileset dir="${dest}"
includes="**/*.*"/>
				</classpath>
		</javac>
	</target>

Let me know what I am missing...

Thanks,

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


RE: Javac task query

Posted by "Yadav, Akshat Kumar " <ak...@citi.com>.
Thanks Steve, I will look into this. 

-----Original Message-----
From: Steve Loughran [mailto:stevel@apache.org] 
Sent: Wednesday, June 27, 2007 5:09 PM
To: Ant Users List
Subject: Re: Javac task query

Yadav, Akshat Kumar wrote:
> Thanks Peter for reply.
> 
> I think ANT developer should think on extending there "javac" task to 
> provide such feature.
> 
> Thanks,
> 

I must disagree. You should get into the habit of doing clean builds on
a regular basis, at least first thing every morning when you check out
the updated code, and *before you create any redistributables*

there's too many ways that .class files can creep in to the
build/classes output other than just compiling source
  rmic
  wsdl2java and a separate javac
  jaxb tasks and a separate javac
  classes in the wrong package/class file name

by having a separate directory for all build time output, a simple
<delete> operation purges your build of all leftover state from  the
previous one, and guarantees that what you ship is what is in CVS/SVN.

For reference, the way we cut releases at work, I have a separate VMware
image (Xubuntu 6.04) purely for checking out code and building releases
on java1.5. It doesnt get used for development, purely checking out,
building, testing, publishing. Every build it even purges the ~/.ivy
directories of artifacts, forcing a clean download by ivy of external
files.

that way we know that what we ship is what we can build repeatedly, not
whatever was on some developers hdd at the time

-steve


> -----Original Message-----
> From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com]
> Sent: Wednesday, June 27, 2007 3:46 PM
> To: Ant Users List
> Subject: Re: Javac task query
> 
> On 6/27/07, Yadav, Akshat Kumar <ak...@citi.com> wrote:
>> Thanks Prashant for reply.
>>
>> I am talking for the situation where a.java, b.java and c.java are 
>> independent java code files.
>>
>> Thanks,
>>
> <javac/> does not remove the c.class file if the c.java file does not 
> exist.
> - i.e. it has no memory of previous compiles. and there may be another

> <javac> task in the build file that could build c.class.
> 
> There are a number of times when similar things happen, if a.java 
> changes a method signature and b.java uses a.java's method, b.java 
> needs to be recompiled, but <javac/> does not know this.
> 
> 
> The common way to deal with problems like this is to have a build 
> directory for *all* the build artifacts (.class files, generated java 
> files, .jar files, javadoc, code coverage files, junit reports,  etc) 
> and have a "clean" target that simply deletes the build directory:
> 
> <target name="clean">
>    <delete dir="build"/>
> </target>
> 
> Peter
> 
>> -----Original Message-----
>> From: Prashant Reddy [mailto:prashant@pramati.com]
>> Sent: Wednesday, June 27, 2007 1:57 PM
>> To: Ant Users List
>> Subject: Re: Javac task query
>>
>> No 'javac' task by itself will not delete class file whose source 
>> java
> 
>> file has been deleted, and rightly so.
>>
>> I do not think you would really want other source files to *not* 
>> compile when you have deleted a dependent source file.
>>
>> Imagine class A uses class C and you deleted class C (manually, and 
>> not using a modern IDE). Even though the time stamp for class A did 
>> not change, you would want to recompile both A, and C.
>>
>> You could have a cleancompile target in your build.xml
>>
>> <target name="cleancompile" depends="remove.classes.dir, compile, 
>> jar"/>
>>
>> The "remove.classes.dir" target would remove all the class files from

>> the ${dest} directory.
>>
>> In the sited Phase 2, you would run the cleancompile target, instead 
>> of simple 'jar' target. This would remove C.class along with other 
>> class files from ${dest} directory. During the next compilation since

>> C.java is deleted C.class will not be generated, and you jar will not

>> have c.class.
>>
>> Hope this helps.
>>
>> -Prashant
>> On Wed, 2007-06-27 at 10:10 +0800, Yadav, Akshat Kumar wrote:
>>> Thanks Steve! It worked.
>>>
>>> But lets say if I have executed compile target on a.java, b.java 
>>> ,c.java it generates a.class, b.class, c.class and then I made jar 
>>> of these class files. Later if I deleted c.java from source and its 
>>> class file is present is in dest dir. And when I will make jar it 
>>> will contain c.class also, that I don't want to be persent in jar 
>>> file as
> 
>>> its corresponding java file is deleted from source dir.
>>>
>>> Reference:
>>> Phase 1:
>>> Source: a.java, b.java, c.java
>>> Dest: a.class, b.class, c.class
>>> Jar: JTQ.jar (contains a.class, b.class, c.class)
>>>
>>> Phase 2 (when I deleted c.java from source dir)
>>> Source: a.java, b.java
>>> Dest: a.class, b.class, c.class
>>> Jar: JTQ.jar (contains a.class, b.class, c.class)
>>>
>>> But I don't want c.class should not be presend in jar. It there any 
>>> option or method to counter with such situation.
>>>
>>> Any help appreciated. If my query is not clear, then let me know...
>>>
>>> Thanks,
>>>
>>> -----Original Message-----
>>> From: Steve Loughran [mailto:stevel@apache.org]
>>> Sent: Tuesday, June 26, 2007 7:04 PM
>>> To: Ant Users List
>>> Subject: Re: Javac task query
>>>
>>> Yadav, Akshat Kumar wrote:
>>>> Hi Prashant,
>>>>
>>>> I had executed ANT in verbose and debug mode and it shows
>>>>
>>>>  [javac] HelloWorlApp.java added as HelloWorlApp.class doesn't
>> exist.
>>>> Whereas the class file exist in dest dir. I tried adding/deleting 
>>>> dest dir in classpath, but no luck in both the situation.
>>>>
>>>> I would appreciate, If you could try this in your environment. I 
>>>> had tried this with ANT 1.6.5/1.7 and java 1.4/1.5.
>>>>
>>>> P.S: Other member's can also suggest me something.
>>>>
>>>> Thanks,
>>> could be the classname in the .java file has a different spelling or
> 
>>> case from the source file itself
>>>
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
>>> additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
>>> additional
>>> commands, e-mail: user-help@ant.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
additional
> 
>> commands, e-mail: user-help@ant.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
additional
> 
>> commands, e-mail: user-help@ant.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


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


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


Re: Javac task query

Posted by Steve Loughran <st...@apache.org>.
Yadav, Akshat Kumar wrote:
> Thanks Peter for reply.
> 
> I think ANT developer should think on extending there "javac" task to
> provide such feature. 
> 
> Thanks,
> 

I must disagree. You should get into the habit of doing clean builds on 
a regular basis, at least first thing every morning when you check out 
the updated code, and *before you create any redistributables*

there's too many ways that .class files can creep in to the 
build/classes output other than just compiling source
  rmic
  wsdl2java and a separate javac
  jaxb tasks and a separate javac
  classes in the wrong package/class file name

by having a separate directory for all build time output, a simple 
<delete> operation purges your build of all leftover state from  the 
previous one, and guarantees that what you ship is what is in CVS/SVN.

For reference, the way we cut releases at work, I have a separate VMware 
image (Xubuntu 6.04) purely for checking out code and building releases 
on java1.5. It doesnt get used for development, purely checking out, 
building, testing, publishing. Every build it even purges the ~/.ivy 
directories of artifacts, forcing a clean download by ivy of external files.

that way we know that what we ship is what we can build repeatedly, not 
whatever was on some developers hdd at the time

-steve


> -----Original Message-----
> From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com] 
> Sent: Wednesday, June 27, 2007 3:46 PM
> To: Ant Users List
> Subject: Re: Javac task query
> 
> On 6/27/07, Yadav, Akshat Kumar <ak...@citi.com> wrote:
>> Thanks Prashant for reply.
>>
>> I am talking for the situation where a.java, b.java and c.java are 
>> independent java code files.
>>
>> Thanks,
>>
> <javac/> does not remove the c.class file if the c.java file does not
> exist.
> - i.e. it has no memory of previous compiles. and there may be another
> <javac> task in the build file that could build c.class.
> 
> There are a number of times when similar things happen, if a.java
> changes a method signature and b.java uses a.java's method, b.java needs
> to be recompiled, but <javac/> does not know this.
> 
> 
> The common way to deal with problems like this is to have a build
> directory for *all* the build artifacts (.class files, generated java
> files, .jar files, javadoc, code coverage files, junit reports,  etc)
> and have a "clean" target that simply deletes the build directory:
> 
> <target name="clean">
>    <delete dir="build"/>
> </target>
> 
> Peter
> 
>> -----Original Message-----
>> From: Prashant Reddy [mailto:prashant@pramati.com]
>> Sent: Wednesday, June 27, 2007 1:57 PM
>> To: Ant Users List
>> Subject: Re: Javac task query
>>
>> No 'javac' task by itself will not delete class file whose source java
> 
>> file has been deleted, and rightly so.
>>
>> I do not think you would really want other source files to *not* 
>> compile when you have deleted a dependent source file.
>>
>> Imagine class A uses class C and you deleted class C (manually, and 
>> not using a modern IDE). Even though the time stamp for class A did 
>> not change, you would want to recompile both A, and C.
>>
>> You could have a cleancompile target in your build.xml
>>
>> <target name="cleancompile" depends="remove.classes.dir, compile, 
>> jar"/>
>>
>> The "remove.classes.dir" target would remove all the class files from 
>> the ${dest} directory.
>>
>> In the sited Phase 2, you would run the cleancompile target, instead 
>> of simple 'jar' target. This would remove C.class along with other 
>> class files from ${dest} directory. During the next compilation since 
>> C.java is deleted C.class will not be generated, and you jar will not 
>> have c.class.
>>
>> Hope this helps.
>>
>> -Prashant
>> On Wed, 2007-06-27 at 10:10 +0800, Yadav, Akshat Kumar wrote:
>>> Thanks Steve! It worked.
>>>
>>> But lets say if I have executed compile target on a.java, b.java 
>>> ,c.java it generates a.class, b.class, c.class and then I made jar 
>>> of these class files. Later if I deleted c.java from source and its 
>>> class
>>> file is present is in dest dir. And when I will make jar it will 
>>> contain c.class also, that I don't want to be persent in jar file as
> 
>>> its corresponding java file is deleted from source dir.
>>>
>>> Reference:
>>> Phase 1:
>>> Source: a.java, b.java, c.java
>>> Dest: a.class, b.class, c.class
>>> Jar: JTQ.jar (contains a.class, b.class, c.class)
>>>
>>> Phase 2 (when I deleted c.java from source dir)
>>> Source: a.java, b.java
>>> Dest: a.class, b.class, c.class
>>> Jar: JTQ.jar (contains a.class, b.class, c.class)
>>>
>>> But I don't want c.class should not be presend in jar. It there any 
>>> option or method to counter with such situation.
>>>
>>> Any help appreciated. If my query is not clear, then let me know...
>>>
>>> Thanks,
>>>
>>> -----Original Message-----
>>> From: Steve Loughran [mailto:stevel@apache.org]
>>> Sent: Tuesday, June 26, 2007 7:04 PM
>>> To: Ant Users List
>>> Subject: Re: Javac task query
>>>
>>> Yadav, Akshat Kumar wrote:
>>>> Hi Prashant,
>>>>
>>>> I had executed ANT in verbose and debug mode and it shows
>>>>
>>>>  [javac] HelloWorlApp.java added as HelloWorlApp.class doesn't
>> exist.
>>>> Whereas the class file exist in dest dir. I tried adding/deleting 
>>>> dest
>>>> dir in classpath, but no luck in both the situation.
>>>>
>>>> I would appreciate, If you could try this in your environment. I 
>>>> had
>>>> tried this with ANT 1.6.5/1.7 and java 1.4/1.5.
>>>>
>>>> P.S: Other member's can also suggest me something.
>>>>
>>>> Thanks,
>>> could be the classname in the .java file has a different spelling or
> 
>>> case from the source file itself
>>>
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
>>> additional
>>> commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
>>> additional
>>> commands, e-mail: user-help@ant.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> 
>> commands, e-mail: user-help@ant.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> 
>> commands, e-mail: user-help@ant.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


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


Re: Javac task query

Posted by "Yadav, Akshat Kumar " <ak...@citi.com>.
Thanks Peter for reply.

I think ANT developer should think on extending there "javac" task to
provide such feature. 

Thanks,

-----Original Message-----
From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com] 
Sent: Wednesday, June 27, 2007 3:46 PM
To: Ant Users List
Subject: Re: Javac task query

On 6/27/07, Yadav, Akshat Kumar <ak...@citi.com> wrote:
>
> Thanks Prashant for reply.
>
> I am talking for the situation where a.java, b.java and c.java are 
> independent java code files.
>
> Thanks,
>
<javac/> does not remove the c.class file if the c.java file does not
exist.
- i.e. it has no memory of previous compiles. and there may be another
<javac> task in the build file that could build c.class.

There are a number of times when similar things happen, if a.java
changes a method signature and b.java uses a.java's method, b.java needs
to be recompiled, but <javac/> does not know this.


The common way to deal with problems like this is to have a build
directory for *all* the build artifacts (.class files, generated java
files, .jar files, javadoc, code coverage files, junit reports,  etc)
and have a "clean" target that simply deletes the build directory:

<target name="clean">
   <delete dir="build"/>
</target>

Peter

> -----Original Message-----
> From: Prashant Reddy [mailto:prashant@pramati.com]
> Sent: Wednesday, June 27, 2007 1:57 PM
> To: Ant Users List
> Subject: Re: Javac task query
>
> No 'javac' task by itself will not delete class file whose source java

> file has been deleted, and rightly so.
>
> I do not think you would really want other source files to *not* 
> compile when you have deleted a dependent source file.
>
> Imagine class A uses class C and you deleted class C (manually, and 
> not using a modern IDE). Even though the time stamp for class A did 
> not change, you would want to recompile both A, and C.
>
> You could have a cleancompile target in your build.xml
>
> <target name="cleancompile" depends="remove.classes.dir, compile, 
> jar"/>
>
> The "remove.classes.dir" target would remove all the class files from 
> the ${dest} directory.
>
> In the sited Phase 2, you would run the cleancompile target, instead 
> of simple 'jar' target. This would remove C.class along with other 
> class files from ${dest} directory. During the next compilation since 
> C.java is deleted C.class will not be generated, and you jar will not 
> have c.class.
>
> Hope this helps.
>
> -Prashant
> On Wed, 2007-06-27 at 10:10 +0800, Yadav, Akshat Kumar wrote:
> > Thanks Steve! It worked.
> >
> > But lets say if I have executed compile target on a.java, b.java 
> > ,c.java it generates a.class, b.class, c.class and then I made jar 
> > of these class files. Later if I deleted c.java from source and its 
> > class
>
> > file is present is in dest dir. And when I will make jar it will 
> > contain c.class also, that I don't want to be persent in jar file as

> > its corresponding java file is deleted from source dir.
> >
> > Reference:
> > Phase 1:
> > Source: a.java, b.java, c.java
> > Dest: a.class, b.class, c.class
> > Jar: JTQ.jar (contains a.class, b.class, c.class)
> >
> > Phase 2 (when I deleted c.java from source dir)
> > Source: a.java, b.java
> > Dest: a.class, b.class, c.class
> > Jar: JTQ.jar (contains a.class, b.class, c.class)
> >
> > But I don't want c.class should not be presend in jar. It there any 
> > option or method to counter with such situation.
> >
> > Any help appreciated. If my query is not clear, then let me know...
> >
> > Thanks,
> >
> > -----Original Message-----
> > From: Steve Loughran [mailto:stevel@apache.org]
> > Sent: Tuesday, June 26, 2007 7:04 PM
> > To: Ant Users List
> > Subject: Re: Javac task query
> >
> > Yadav, Akshat Kumar wrote:
> > >
> > > Hi Prashant,
> > >
> > > I had executed ANT in verbose and debug mode and it shows
> > >
> > >  [javac] HelloWorlApp.java added as HelloWorlApp.class doesn't
> exist.
> > >
> > > Whereas the class file exist in dest dir. I tried adding/deleting 
> > > dest
> >
> > > dir in classpath, but no luck in both the situation.
> > >
> > > I would appreciate, If you could try this in your environment. I 
> > > had
>
> > > tried this with ANT 1.6.5/1.7 and java 1.4/1.5.
> > >
> > > P.S: Other member's can also suggest me something.
> > >
> > > Thanks,
> >
> > could be the classname in the .java file has a different spelling or

> > case from the source file itself
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
> > additional
>
> > commands, e-mail: user-help@ant.apache.org
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
> > additional
>
> > commands, e-mail: user-help@ant.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional

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

> commands, e-mail: user-help@ant.apache.org
>
>

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


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


Re: Javac task query

Posted by Peter Reilly <pe...@gmail.com>.
On 6/27/07, Yadav, Akshat Kumar <ak...@citi.com> wrote:
>
> Thanks Prashant for reply.
>
> I am talking for the situation where a.java, b.java and c.java are
> independent java code files.
>
> Thanks,
>
<javac/> does not remove the c.class file if the c.java file does not exist.
- i.e. it has no memory of previous compiles. and there may be another <javac>
task in the build file that could build c.class.

There are a number of times when similar things happen, if a.java changes
a method signature and b.java uses a.java's method, b.java needs to be
recompiled, but <javac/> does not know this.


The common way to deal with problems like this is to
have a build directory for *all* the build artifacts (.class files,
generated java files,
.jar files, javadoc, code coverage files, junit reports,  etc)
and have a "clean" target that simply deletes the build directory:

<target name="clean">
   <delete dir="build"/>
</target>

Peter

> -----Original Message-----
> From: Prashant Reddy [mailto:prashant@pramati.com]
> Sent: Wednesday, June 27, 2007 1:57 PM
> To: Ant Users List
> Subject: Re: Javac task query
>
> No 'javac' task by itself will not delete class file whose source java
> file has been deleted, and rightly so.
>
> I do not think you would really want other source files to *not* compile
> when you have deleted a dependent source file.
>
> Imagine class A uses class C and you deleted class C (manually, and not
> using a modern IDE). Even though the time stamp for class A did not
> change, you would want to recompile both A, and C.
>
> You could have a cleancompile target in your build.xml
>
> <target name="cleancompile" depends="remove.classes.dir, compile, jar"/>
>
> The "remove.classes.dir" target would remove all the class files from
> the ${dest} directory.
>
> In the sited Phase 2, you would run the cleancompile target, instead of
> simple 'jar' target. This would remove C.class along with other class
> files from ${dest} directory. During the next compilation since C.java
> is deleted C.class will not be generated, and you jar will not have
> c.class.
>
> Hope this helps.
>
> -Prashant
> On Wed, 2007-06-27 at 10:10 +0800, Yadav, Akshat Kumar wrote:
> > Thanks Steve! It worked.
> >
> > But lets say if I have executed compile target on a.java, b.java
> > ,c.java it generates a.class, b.class, c.class and then I made jar of
> > these class files. Later if I deleted c.java from source and its class
>
> > file is present is in dest dir. And when I will make jar it will
> > contain c.class also, that I don't want to be persent in jar file as
> > its corresponding java file is deleted from source dir.
> >
> > Reference:
> > Phase 1:
> > Source: a.java, b.java, c.java
> > Dest: a.class, b.class, c.class
> > Jar: JTQ.jar (contains a.class, b.class, c.class)
> >
> > Phase 2 (when I deleted c.java from source dir)
> > Source: a.java, b.java
> > Dest: a.class, b.class, c.class
> > Jar: JTQ.jar (contains a.class, b.class, c.class)
> >
> > But I don't want c.class should not be presend in jar. It there any
> > option or method to counter with such situation.
> >
> > Any help appreciated. If my query is not clear, then let me know...
> >
> > Thanks,
> >
> > -----Original Message-----
> > From: Steve Loughran [mailto:stevel@apache.org]
> > Sent: Tuesday, June 26, 2007 7:04 PM
> > To: Ant Users List
> > Subject: Re: Javac task query
> >
> > Yadav, Akshat Kumar wrote:
> > >
> > > Hi Prashant,
> > >
> > > I had executed ANT in verbose and debug mode and it shows
> > >
> > >  [javac] HelloWorlApp.java added as HelloWorlApp.class doesn't
> exist.
> > >
> > > Whereas the class file exist in dest dir. I tried adding/deleting
> > > dest
> >
> > > dir in classpath, but no luck in both the situation.
> > >
> > > I would appreciate, If you could try this in your environment. I had
>
> > > tried this with ANT 1.6.5/1.7 and java 1.4/1.5.
> > >
> > > P.S: Other member's can also suggest me something.
> > >
> > > Thanks,
> >
> > could be the classname in the .java file has a different spelling or
> > case from the source file itself
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
>
> > commands, e-mail: user-help@ant.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
>
> > commands, e-mail: user-help@ant.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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


Re: Javac task query

Posted by Wayne Cannon <wc...@turinnetworks.com>.
Keep in mind that a class file is generated for every Java class, NOT 
for every source file.  Source files can contain multiple classes 
(although I generally don't like the practice, it's very common for 
listener classes in GUI code).  If B.java defined classes B and C, the 
compiler would generate B.class and C.class.  You would not want any 
tool to delete C.class just because there was no corresponding C.java.
--Wayne

Yadav, Akshat Kumar wrote:
> Thanks Prashant for reply.
>
> I am talking for the situation where a.java, b.java and c.java are
> independent java code files.
>
> Thanks, 
>   

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


RE: Javac task query

Posted by "Yadav, Akshat Kumar " <ak...@citi.com>.
Thanks Prashant for reply.

I am talking for the situation where a.java, b.java and c.java are
independent java code files.

Thanks, 

-----Original Message-----
From: Prashant Reddy [mailto:prashant@pramati.com] 
Sent: Wednesday, June 27, 2007 1:57 PM
To: Ant Users List
Subject: Re: Javac task query

No 'javac' task by itself will not delete class file whose source java
file has been deleted, and rightly so. 

I do not think you would really want other source files to *not* compile
when you have deleted a dependent source file. 

Imagine class A uses class C and you deleted class C (manually, and not
using a modern IDE). Even though the time stamp for class A did not
change, you would want to recompile both A, and C.

You could have a cleancompile target in your build.xml 

<target name="cleancompile" depends="remove.classes.dir, compile, jar"/>

The "remove.classes.dir" target would remove all the class files from
the ${dest} directory.

In the sited Phase 2, you would run the cleancompile target, instead of
simple 'jar' target. This would remove C.class along with other class
files from ${dest} directory. During the next compilation since C.java
is deleted C.class will not be generated, and you jar will not have
c.class.

Hope this helps.

-Prashant
On Wed, 2007-06-27 at 10:10 +0800, Yadav, Akshat Kumar wrote:
> Thanks Steve! It worked.
> 
> But lets say if I have executed compile target on a.java, b.java 
> ,c.java it generates a.class, b.class, c.class and then I made jar of 
> these class files. Later if I deleted c.java from source and its class

> file is present is in dest dir. And when I will make jar it will 
> contain c.class also, that I don't want to be persent in jar file as 
> its corresponding java file is deleted from source dir.
> 
> Reference:
> Phase 1:
> Source: a.java, b.java, c.java
> Dest: a.class, b.class, c.class
> Jar: JTQ.jar (contains a.class, b.class, c.class)
> 
> Phase 2 (when I deleted c.java from source dir)
> Source: a.java, b.java
> Dest: a.class, b.class, c.class
> Jar: JTQ.jar (contains a.class, b.class, c.class)
> 
> But I don't want c.class should not be presend in jar. It there any 
> option or method to counter with such situation.
> 
> Any help appreciated. If my query is not clear, then let me know...
> 
> Thanks,
> 
> -----Original Message-----
> From: Steve Loughran [mailto:stevel@apache.org]
> Sent: Tuesday, June 26, 2007 7:04 PM
> To: Ant Users List
> Subject: Re: Javac task query
> 
> Yadav, Akshat Kumar wrote:
> >  
> > Hi Prashant,
> > 
> > I had executed ANT in verbose and debug mode and it shows
> > 
> >  [javac] HelloWorlApp.java added as HelloWorlApp.class doesn't
exist.
> > 
> > Whereas the class file exist in dest dir. I tried adding/deleting 
> > dest
> 
> > dir in classpath, but no luck in both the situation.
> > 
> > I would appreciate, If you could try this in your environment. I had

> > tried this with ANT 1.6.5/1.7 and java 1.4/1.5.
> > 
> > P.S: Other member's can also suggest me something.
> > 
> > Thanks,
> 
> could be the classname in the .java file has a different spelling or 
> case from the source file itself
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional

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

> commands, e-mail: user-help@ant.apache.org


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


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


Re: Javac task query

Posted by Prashant Reddy <pr...@pramati.com>.
No 'javac' task by itself will not delete class file whose source java
file has been deleted, and rightly so. 

I do not think you would really want other source files to *not* compile
when you have deleted a dependent source file. 

Imagine class A uses class C and you deleted class C (manually, and not
using a modern IDE). Even though the time stamp for class A did not
change, you would want to recompile both A, and C.

You could have a cleancompile target in your build.xml 

<target name="cleancompile" depends="remove.classes.dir, compile, jar"/>

The "remove.classes.dir" target would remove all the class files from
the ${dest} directory.

In the sited Phase 2, you would run the cleancompile target, instead of
simple 'jar' target. This would remove C.class along with other class
files from ${dest} directory. During the next compilation since C.java
is deleted C.class will not be generated, and you jar will not have
c.class.

Hope this helps.

-Prashant
On Wed, 2007-06-27 at 10:10 +0800, Yadav, Akshat Kumar wrote:
> Thanks Steve! It worked.
> 
> But lets say if I have executed compile target on a.java, b.java ,c.java
> it generates a.class, b.class, c.class and then I made jar of these
> class files. Later if I deleted c.java from source and its class file is
> present is in dest dir. And when I will make jar it will contain c.class
> also, that I don't want to be persent in jar file as its corresponding
> java file is deleted from source dir.
> 
> Reference:
> Phase 1:
> Source: a.java, b.java, c.java
> Dest: a.class, b.class, c.class
> Jar: JTQ.jar (contains a.class, b.class, c.class) 
> 
> Phase 2 (when I deleted c.java from source dir)
> Source: a.java, b.java
> Dest: a.class, b.class, c.class
> Jar: JTQ.jar (contains a.class, b.class, c.class) 
> 
> But I don't want c.class should not be presend in jar. It there any
> option or method to counter with such situation.
> 
> Any help appreciated. If my query is not clear, then let me know...
> 
> Thanks,
> 
> -----Original Message-----
> From: Steve Loughran [mailto:stevel@apache.org] 
> Sent: Tuesday, June 26, 2007 7:04 PM
> To: Ant Users List
> Subject: Re: Javac task query
> 
> Yadav, Akshat Kumar wrote:
> >  
> > Hi Prashant,
> > 
> > I had executed ANT in verbose and debug mode and it shows
> > 
> >  [javac] HelloWorlApp.java added as HelloWorlApp.class doesn't exist.
> > 
> > Whereas the class file exist in dest dir. I tried adding/deleting dest
> 
> > dir in classpath, but no luck in both the situation.
> > 
> > I would appreciate, If you could try this in your environment. I had 
> > tried this with ANT 1.6.5/1.7 and java 1.4/1.5.
> > 
> > P.S: Other member's can also suggest me something.
> > 
> > Thanks,
> 
> could be the classname in the .java file has a different spelling or
> case from the source file itself
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


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


Re: Javac task query

Posted by "Yadav, Akshat Kumar " <ak...@citi.com>.
Thanks Steve! It worked.

But lets say if I have executed compile target on a.java, b.java ,c.java
it generates a.class, b.class, c.class and then I made jar of these
class files. Later if I deleted c.java from source and its class file is
present is in dest dir. And when I will make jar it will contain c.class
also, that I don't want to be persent in jar file as its corresponding
java file is deleted from source dir.

Reference:
Phase 1:
Source: a.java, b.java, c.java
Dest: a.class, b.class, c.class
Jar: JTQ.jar (contains a.class, b.class, c.class) 

Phase 2 (when I deleted c.java from source dir)
Source: a.java, b.java
Dest: a.class, b.class, c.class
Jar: JTQ.jar (contains a.class, b.class, c.class) 

But I don't want c.class should not be presend in jar. It there any
option or method to counter with such situation.

Any help appreciated. If my query is not clear, then let me know...

Thanks,

-----Original Message-----
From: Steve Loughran [mailto:stevel@apache.org] 
Sent: Tuesday, June 26, 2007 7:04 PM
To: Ant Users List
Subject: Re: Javac task query

Yadav, Akshat Kumar wrote:
>  
> Hi Prashant,
> 
> I had executed ANT in verbose and debug mode and it shows
> 
>  [javac] HelloWorlApp.java added as HelloWorlApp.class doesn't exist.
> 
> Whereas the class file exist in dest dir. I tried adding/deleting dest

> dir in classpath, but no luck in both the situation.
> 
> I would appreciate, If you could try this in your environment. I had 
> tried this with ANT 1.6.5/1.7 and java 1.4/1.5.
> 
> P.S: Other member's can also suggest me something.
> 
> Thanks,

could be the classname in the .java file has a different spelling or
case from the source file itself

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


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


Re: Javac task query

Posted by Steve Loughran <st...@apache.org>.
Yadav, Akshat Kumar wrote:
>  
> Hi Prashant,
> 
> I had executed ANT in verbose and debug mode and it shows
> 
>  [javac] HelloWorlApp.java added as HelloWorlApp.class doesn't exist.
> 
> Whereas the class file exist in dest dir. I tried adding/deleting dest
> dir in classpath, but no luck in both the situation.
> 
> I would appreciate, If you could try this in your environment. I had
> tried this with ANT 1.6.5/1.7 and java 1.4/1.5.
> 
> P.S: Other member's can also suggest me something.
> 
> Thanks,

could be the classname in the .java file has a different spelling or 
case from the source file itself

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


Re: Javac task query

Posted by "Yadav, Akshat Kumar " <ak...@citi.com>.
 
Hi Prashant,

I had executed ANT in verbose and debug mode and it shows

 [javac] HelloWorlApp.java added as HelloWorlApp.class doesn't exist.

Whereas the class file exist in dest dir. I tried adding/deleting dest
dir in classpath, but no luck in both the situation.

I would appreciate, If you could try this in your environment. I had
tried this with ANT 1.6.5/1.7 and java 1.4/1.5.

P.S: Other member's can also suggest me something.

Thanks,

-----Original Message-----
From: Prashant Reddy [mailto:prashant@pramati.com] 
Sent: Tuesday, June 26, 2007 5:41 PM
To: Ant Users List
Subject: RE: Javac task query

Humm..

May be you could try running ANT in verbose mode, see why ANT thinks it
should compile .java files that are not modified.

Also, I think the destination dir the classes are directed to is
automatically added to classpath by ANT. So you may not need this :

> <fileset dir="${dest}"
> includes="**/*.*"/>
> </classpath>

HTH
On Tue, 2007-06-26 at 17:24 +0800, Yadav, Akshat Kumar wrote:
>  Thanks Prashant for reply. 
> 
> I had gone through this link earlier, my source dir structure mirrors 
> package dir structure. Even I tried to put the source and dest dir as 
> single dir.
> 
> <project name="Ant " default="compile" basedir="."> <property 
> name="src" value="C:\Documents and Settings\ay03416\My 
> Documents\RanD\ant\src"/> <property name="dest" value="C:\Documents 
> and Settings\ay03416\My Documents\RanD\ant\dest" /> <property 
> name="lib" value="C:\Documents and Settings\ay03416\My 
> Documents\RanD\ant\lib" />
> 
> 	<target name="compile">
> 		<javac srcdir="${src}" destdir="${dest}"
> deprecation="no" debug="on" listfiles="yes">
> 				<classpath>
> 					<fileset dir="${lib}"
> includes="**/*.jar **/*.zip"/>
> 					<fileset dir="${dest}"
> includes="**/*.*"/>
> 				</classpath>
> 		</javac>
> 	</target>
> </project>
> 
> Any suggestion's welcome... Also, I had gone to following links, but 
> no luck for me :(
> 
> http://mail-archives.apache.org/mod_mbox/ant-user/200111.mbox/%3cKCEIJ
> FM KLJJOJIBAAPJMAEPPCOAA.ttm@online.no%3e
> http://article.gmane.org/gmane.comp.jakarta.ant.user/42524
> http://marc.info/?l=ant-user&m=97303040120654&w=2
> http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg01615.html
> http://mail-archives.apache.org/mod_mbox/ant-user/200009.mbox/%3cNDBBI
> MH CHMPELMBMMFIMEEDKDPAA.conor@ebinteractive.com.au%3e
> https://issues.apache.org/struts/browse/STR-2403
> 
> Thanks,
> 
> -----Original Message-----
> From: Prashant Reddy [mailto:prashant@pramati.com]
> Sent: Tuesday, June 26, 2007 5:17 PM
> To: Ant Users List
> Subject: Re: Javac task query
> 
> Please see :
> http://ant.apache.org/faq.html#always-recompiles
> 
> HTH
> 
> On Tue, 2007-06-26 at 16:15 +0800, Yadav, Akshat Kumar wrote:
> > Hi All,
> > 
> > Ant manual says "The source and destination directory will be 
> > recursively scanned for Java source files to compile. Only Java 
> > files that have no corresponding .class file or where the class file

> > is older than the .java file will be compiled."
> > 
> > Reference: http://ant.apache.org/manual/CoreTasks/javac.html
> > 
> > But, when I compile my java files through using ANT javav task, all 
> > files gets compiled every time. Rather, I want it to compile only 
> > those files that have no corresponding .class file or where the 
> > class file is older than the .java file.
> > 
> > Code:
> > 
> > 	<target name="compile">
> > 		<javac srcdir="${src}" destdir="${dest}"
> > deprecation="no" debug="on" listfiles="yes">
> > 				<classpath>
> > 					<fileset dir="${lib}"
> > includes="**/*.jar **/*.zip"/>
> > 					<fileset dir="${dest}"
> > includes="**/*.*"/>
> > 				</classpath>
> > 		</javac>
> > 	</target>
> > 
> > Let me know what I am missing...
> > 
> > Thanks,
> > 
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
> > additional
> 
> > commands, e-mail: user-help@ant.apache.org
-- 

-Prashant

Don't upload, just share : www.dekoh.com


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


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


RE: Javac task query

Posted by Prashant Reddy <pr...@pramati.com>.
Humm..

May be you could try running ANT in verbose mode, see why ANT thinks it
should compile .java files that are not modified.

Also, I think the destination dir the classes are directed to is
automatically added to classpath by ANT. So you may not need this :

> <fileset dir="${dest}"
> includes="**/*.*"/>
> </classpath>

HTH
On Tue, 2007-06-26 at 17:24 +0800, Yadav, Akshat Kumar wrote:
>  Thanks Prashant for reply. 
> 
> I had gone through this link earlier, my source dir structure mirrors
> package dir structure. Even I tried to put the source and dest dir as
> single dir.
> 
> <project name="Ant " default="compile" basedir=".">
> <property name="src" value="C:\Documents and Settings\ay03416\My
> Documents\RanD\ant\src"/>
> <property name="dest" value="C:\Documents and Settings\ay03416\My
> Documents\RanD\ant\dest" />
> <property name="lib" value="C:\Documents and Settings\ay03416\My
> Documents\RanD\ant\lib" />
> 
> 	<target name="compile">
> 		<javac srcdir="${src}" destdir="${dest}"
> deprecation="no" debug="on" listfiles="yes">
> 				<classpath>
> 					<fileset dir="${lib}"
> includes="**/*.jar **/*.zip"/>
> 					<fileset dir="${dest}"
> includes="**/*.*"/>
> 				</classpath>
> 		</javac>
> 	</target>
> </project>
> 
> Any suggestion's welcome... Also, I had gone to following links, but no
> luck for me :(
> 
> http://mail-archives.apache.org/mod_mbox/ant-user/200111.mbox/%3cKCEIJFM
> KLJJOJIBAAPJMAEPPCOAA.ttm@online.no%3e
> http://article.gmane.org/gmane.comp.jakarta.ant.user/42524
> http://marc.info/?l=ant-user&m=97303040120654&w=2
> http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg01615.html
> http://mail-archives.apache.org/mod_mbox/ant-user/200009.mbox/%3cNDBBIMH
> CHMPELMBMMFIMEEDKDPAA.conor@ebinteractive.com.au%3e
> https://issues.apache.org/struts/browse/STR-2403
> 
> Thanks,
> 
> -----Original Message-----
> From: Prashant Reddy [mailto:prashant@pramati.com] 
> Sent: Tuesday, June 26, 2007 5:17 PM
> To: Ant Users List
> Subject: Re: Javac task query
> 
> Please see :
> http://ant.apache.org/faq.html#always-recompiles
> 
> HTH
> 
> On Tue, 2007-06-26 at 16:15 +0800, Yadav, Akshat Kumar wrote:
> > Hi All,
> > 
> > Ant manual says "The source and destination directory will be 
> > recursively scanned for Java source files to compile. Only Java files 
> > that have no corresponding .class file or where the class file is 
> > older than the .java file will be compiled."
> > 
> > Reference: http://ant.apache.org/manual/CoreTasks/javac.html
> > 
> > But, when I compile my java files through using ANT javav task, all 
> > files gets compiled every time. Rather, I want it to compile only 
> > those files that have no corresponding .class file or where the class 
> > file is older than the .java file.
> > 
> > Code:
> > 
> > 	<target name="compile">
> > 		<javac srcdir="${src}" destdir="${dest}"
> > deprecation="no" debug="on" listfiles="yes">
> > 				<classpath>
> > 					<fileset dir="${lib}"
> > includes="**/*.jar **/*.zip"/>
> > 					<fileset dir="${dest}"
> > includes="**/*.*"/>
> > 				</classpath>
> > 		</javac>
> > 	</target>
> > 
> > Let me know what I am missing...
> > 
> > Thanks,
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
> 
> > commands, e-mail: user-help@ant.apache.org
-- 

-Prashant

Don't upload, just share : www.dekoh.com


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


RE: Javac task query

Posted by "Yadav, Akshat Kumar " <ak...@citi.com>.
 
Thanks Prashant for reply. 

I had gone through this link earlier, my source dir structure mirrors
package dir structure. Even I tried to put the source and dest dir as
single dir.

<project name="Ant " default="compile" basedir=".">
<property name="src" value="C:\Documents and Settings\ay03416\My
Documents\RanD\ant\src"/>
<property name="dest" value="C:\Documents and Settings\ay03416\My
Documents\RanD\ant\dest" />
<property name="lib" value="C:\Documents and Settings\ay03416\My
Documents\RanD\ant\lib" />

	<target name="compile">
		<javac srcdir="${src}" destdir="${dest}"
deprecation="no" debug="on" listfiles="yes">
				<classpath>
					<fileset dir="${lib}"
includes="**/*.jar **/*.zip"/>
					<fileset dir="${dest}"
includes="**/*.*"/>
				</classpath>
		</javac>
	</target>
</project>

Any suggestion's welcome... Also, I had gone to following links, but no
luck for me :(

http://mail-archives.apache.org/mod_mbox/ant-user/200111.mbox/%3cKCEIJFM
KLJJOJIBAAPJMAEPPCOAA.ttm@online.no%3e
http://article.gmane.org/gmane.comp.jakarta.ant.user/42524
http://marc.info/?l=ant-user&m=97303040120654&w=2
http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg01615.html
http://mail-archives.apache.org/mod_mbox/ant-user/200009.mbox/%3cNDBBIMH
CHMPELMBMMFIMEEDKDPAA.conor@ebinteractive.com.au%3e
https://issues.apache.org/struts/browse/STR-2403

Thanks,

-----Original Message-----
From: Prashant Reddy [mailto:prashant@pramati.com] 
Sent: Tuesday, June 26, 2007 5:17 PM
To: Ant Users List
Subject: Re: Javac task query

Please see :
http://ant.apache.org/faq.html#always-recompiles

HTH

On Tue, 2007-06-26 at 16:15 +0800, Yadav, Akshat Kumar wrote:
> Hi All,
> 
> Ant manual says "The source and destination directory will be 
> recursively scanned for Java source files to compile. Only Java files 
> that have no corresponding .class file or where the class file is 
> older than the .java file will be compiled."
> 
> Reference: http://ant.apache.org/manual/CoreTasks/javac.html
> 
> But, when I compile my java files through using ANT javav task, all 
> files gets compiled every time. Rather, I want it to compile only 
> those files that have no corresponding .class file or where the class 
> file is older than the .java file.
> 
> Code:
> 
> 	<target name="compile">
> 		<javac srcdir="${src}" destdir="${dest}"
> deprecation="no" debug="on" listfiles="yes">
> 				<classpath>
> 					<fileset dir="${lib}"
> includes="**/*.jar **/*.zip"/>
> 					<fileset dir="${dest}"
> includes="**/*.*"/>
> 				</classpath>
> 		</javac>
> 	</target>
> 
> Let me know what I am missing...
> 
> Thanks,
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional

> commands, e-mail: user-help@ant.apache.org
-- 

-Prashant

Don't upload, just share : www.dekoh.com


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


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


Re: Javac task query

Posted by Prashant Reddy <pr...@pramati.com>.
Please see :
http://ant.apache.org/faq.html#always-recompiles

HTH

On Tue, 2007-06-26 at 16:15 +0800, Yadav, Akshat Kumar wrote:
> Hi All,
> 
> Ant manual says "The source and destination directory will be
> recursively scanned for Java source files to compile. Only Java files
> that have no corresponding .class file or where the class file is older
> than the .java file will be compiled."
> 
> Reference: http://ant.apache.org/manual/CoreTasks/javac.html
> 
> But, when I compile my java files through using ANT javav task, all
> files gets compiled every time. Rather, I want it to compile only those
> files that have no corresponding .class file or where the class file is
> older than the .java file. 
> 
> Code:
> 
> 	<target name="compile">
> 		<javac srcdir="${src}" destdir="${dest}"
> deprecation="no" debug="on" listfiles="yes">
> 				<classpath>
> 					<fileset dir="${lib}"
> includes="**/*.jar **/*.zip"/>
> 					<fileset dir="${dest}"
> includes="**/*.*"/>
> 				</classpath>
> 		</javac>
> 	</target>
> 
> Let me know what I am missing...
> 
> Thanks,
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
-- 

-Prashant

Don't upload, just share : www.dekoh.com


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