aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Automatically executing targets on change Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Automatically executing targets on change" Watch "Automatically executing targets on change" New topic

Automatically executing targets on change

Carl Tardif

Joined: Jul 04, 2006
Posts: 8

It will be easier to illustrate what I want to do with an example:

When we "deploy", we copy everything from our main/deploy folder to our generated build/deploy folder.

I would like to know if it is possible for Ant to copy ONLY the files that were modified since the last deploy and how to achieve this ?

Also, would it be possible for Ant to detect changes in the main/deploy folder and to automatically do the deploy when a change is made to any file in main/deploy ?

I've looked for a way to achieve this in the ant manual and accross the web, I have seen the <UpToDate> task but I fail to see how to actually include it in my code to be able to automatically detect changes to files in a folder and then call a target only on modified files when such a change is detected.

All help is appreciated. Thanks in advance.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15665

Normally Ant won't copy files unless they've changed. Have you tried a simple <copy> and verified that it won't do that?

Customer surveys are for companies who didn't pay proper attention to begin with.
Carl Tardif

Joined: Jul 04, 2006
Posts: 8
Yes I have tried that and it works as it should. I also found out there is no way to automatically trigger a target when a file is modified.

Thanks for the reply, I think I will have to look for a workaround to this.
I agree. Here's the link:
subject: Automatically executing targets on change
Similar Threads
Web App Deployment
How to Use VSS Ant tasks to get only last modified files?
Problem in detecting Resolution change
Modification of JSP file using ANT
Flex 3 with Java: Is flex matured enough to really support enterprise applications?