how to force recompile everything using javac task

View: New views
6 Messages — Rating Filter:   Alert me  

how to force recompile everything using javac task

by Guo-ping.Zhang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

how to force recompile everything using javac task?
Javac task always compare modify time with target classes. I want to
recompile java source no matter target classes exists and newer.

Is there any options to achieve this?

Thanks,

RE: how to force recompile everything using javac task

by Raymond Berg (ALLETE) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'd have to go with the previous recommendations on this topic and say
that wiping *.class files would be the easiest solution here.

http://mail-archives.apache.org/mod_mbox/ant-user/200509.mbox/%3C4320007
0.1010403@...%3E

However, if there are other restrictions such as class files in the same
directory that can't be stripped because it was a packaged class or
whatever, well....that's a little worse. But this appears to be the most
common solution to this issue.

Cheers,

Raymond



-----Original Message-----
From: Guo-ping.Zhang@... [mailto:Guo-ping.Zhang@...]
Sent: Tuesday, July 01, 2008 2:06 AM
To: user@...
Subject: how to force recompile everything using javac task

Hi,

how to force recompile everything using javac task?
Javac task always compare modify time with target classes. I want to
recompile java source no matter target classes exists and newer.

Is there any options to achieve this?

Thanks,

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


RE: how to force recompile everything using javac task

by Guo-ping.Zhang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Raymond,

Thanks for your reply.
Actually I have two <javac> task in my build.xml. First <javac> task would
compile everything from src dir "Adir" and jar it. Second <javac> task
will compile a few java file from "Bdir" which could override some of
first ones and create another jar again. If I put a delete task before
second javac task, I would need to selectively delete some java classes
instead of deleting the whole output directory which is a little bit
complex :-). It would be nice if there is some other options to do this.
I tried using "touch" java source before second <javac>. It works but it
changes the source code modified time which is not desirable.

Regards,




"Raymond Berg (ALLETE)" <rberg@...>
07/01/2008 07:22 PM
Please respond to
"Ant Users List" <user@...>


To
"Ant Users List" <user@...>
cc

Subject
RE: how to force recompile everything using javac task






I'd have to go with the previous recommendations on this topic and say
that wiping *.class files would be the easiest solution here.

http://mail-archives.apache.org/mod_mbox/ant-user/200509.mbox/%3C4320007
0.1010403@...%3E

However, if there are other restrictions such as class files in the same
directory that can't be stripped because it was a packaged class or
whatever, well....that's a little worse. But this appears to be the most
common solution to this issue.

Cheers,

Raymond



-----Original Message-----
From: Guo-ping.Zhang@... [mailto:Guo-ping.Zhang@...]
Sent: Tuesday, July 01, 2008 2:06 AM
To: user@...
Subject: how to force recompile everything using javac task

Hi,

how to force recompile everything using javac task?
Javac task always compare modify time with target classes. I want to
recompile java source no matter target classes exists and newer.

Is there any options to achieve this?

Thanks,

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




Re: how to force recompile everything using javac task

by Andy Stevens-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/7/2  <Guo-ping.Zhang@...>:

> Hi Raymond,
>
> Thanks for your reply.
> Actually I have two <javac> task in my build.xml. First <javac> task would
> compile everything from src dir "Adir" and jar it. Second <javac> task
> will compile a few java file from "Bdir" which could override some of
> first ones and create another jar again. If I put a delete task before
> second javac task, I would need to selectively delete some java classes
> instead of deleting the whole output directory which is a little bit
> complex :-). It would be nice if there is some other options to do this.
> I tried using "touch" java source before second <javac>. It works but it
> changes the source code modified time which is not desirable.

Why not <copy> the sources from each of those source directories in
turn to some other directory (build/mergedsrc?), then run a single
<javac> on that directory instead?
Using <copy preservelastmodified="true"> should ensure the javac
doesn't think the combined source files have changed unless the
corresponding ones in the original directory (or their overrides)
have, and therefore shouldn't recompile any classes unless it needs
to.


Andy.
--
http://pseudoq.sourceforge.net/  Open source java Sudoku creator

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


Re: how to force recompile everything using javac task

by Geoffrey Mitchell-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andy Stevens wrote:

>2008/7/2  <Guo-ping.Zhang@...>:
>  
>
>>Hi Raymond,
>>
>>Thanks for your reply.
>>Actually I have two <javac> task in my build.xml. First <javac> task would
>>compile everything from src dir "Adir" and jar it. Second <javac> task
>>will compile a few java file from "Bdir" which could override some of
>>first ones and create another jar again. If I put a delete task before
>>second javac task, I would need to selectively delete some java classes
>>instead of deleting the whole output directory which is a little bit
>>complex :-). It would be nice if there is some other options to do this.
>>I tried using "touch" java source before second <javac>. It works but it
>>changes the source code modified time which is not desirable.
>>    
>>
>
>Why not <copy> the sources from each of those source directories in
>turn to some other directory (build/mergedsrc?), then run a single
><javac> on that directory instead?
>Using <copy preservelastmodified="true"> should ensure the javac
>doesn't think the combined source files have changed unless the
>corresponding ones in the original directory (or their overrides)
>have, and therefore shouldn't recompile any classes unless it needs
>to.
>
>
>Andy.
>  
>
Alternately, you could do the delete using a present filter with a
mapper (it's really not so complicated), so you only delete classes with
sources in Bdir.  Or copy classes that don't have sources in BDir to an
alternate build dir, so your jar tasks are repeatable.  Or merge the
sources as recommended above.

Of course, IMHO, the better solution would be to not have two different
distributions in which the same classes (by name) have different
behaviors.  That sounds a little screwy to me.  Different
implementations of the same interface? OK  One class extends the other
and modifies behaviors?  OK  Re-compile codebase with a few source files
replaced to change behavior?  Kinda sounds like the wrong way to go
about it.

--
Geoffrey Mitchell
Programmer/Analyst
Home Decorator's Collection
314-684-1062


Re: how to force recompile everything using javac task

by David Weintraub :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Why not use the "dest" parameter and have the two <javac> task compile
their code to two different directories. That way, when you run your
build.xml again, it doesn't have to recompile everything.

I always use the "dest" parameter of the <javac> task. I mainly do
this, so all code compiles into a special build directory under the
directory where my build.xml is stored. I also build my *.jars there,
etc. That way, my <clean> target only has to delete the special build
directory.

--
David Weintraub
qazwart@...


On Tue, Jul 1, 2008 at 8:30 PM,  <Guo-ping.Zhang@...> wrote:

> Hi Raymond,
>
> Thanks for your reply.
> Actually I have two <javac> task in my build.xml. First <javac> task would
> compile everything from src dir "Adir" and jar it. Second <javac> task
> will compile a few java file from "Bdir" which could override some of
> first ones and create another jar again. If I put a delete task before
> second javac task, I would need to selectively delete some java classes
> instead of deleting the whole output directory which is a little bit
> complex :-). It would be nice if there is some other options to do this.
> I tried using "touch" java source before second <javac>. It works but it
> changes the source code modified time which is not desirable.
>
> Regards,
>
>
>
>
> "Raymond Berg (ALLETE)" <rberg@...>
> 07/01/2008 07:22 PM
> Please respond to
> "Ant Users List" <user@...>
>
>
> To
> "Ant Users List" <user@...>
> cc
>
> Subject
> RE: how to force recompile everything using javac task
>
>
>
>
>
>
> I'd have to go with the previous recommendations on this topic and say
> that wiping *.class files would be the easiest solution here.
>
> http://mail-archives.apache.org/mod_mbox/ant-user/200509.mbox/%3C4320007
> 0.1010403@...%3E
>
> However, if there are other restrictions such as class files in the same
> directory that can't be stripped because it was a packaged class or
> whatever, well....that's a little worse. But this appears to be the most
> common solution to this issue.
>
> Cheers,
>
> Raymond
>
>
>
> -----Original Message-----
> From: Guo-ping.Zhang@... [mailto:Guo-ping.Zhang@...]
> Sent: Tuesday, July 01, 2008 2:06 AM
> To: user@...
> Subject: how to force recompile everything using javac task
>
> Hi,
>
> how to force recompile everything using javac task?
> Javac task always compare modify time with target classes. I want to
> recompile java source no matter target classes exists and newer.
>
> Is there any options to achieve this?
>
> Thanks,
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>
>
>

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