Our build script copies files out to common file server. The situation is that developers sometimes manually copy certain files to this file server, and don't realize that they had copied over a read-only file. When the build script runs at night, it copies over all the files from source control to this file server and when it encounters a read-only file that was copied over earlier during the day, it fails to replace the file. We started seeing this issue when we upgraded from ant 1.7 to 1.8.1, so I think the earlier version of ant used to replace read-only files without the need of the force attribute. Anyhow I think the ideal solution would be to modify the build-script to delete all the files on the file-server before copying over files from source control. Thanks for your help :)
--- On Fri, 7/23/10, David Weintraub <[email protected]> wrote: From: David Weintraub <[email protected]> Subject: Re: CopyTask: attribute to overwrite readonly files To: "Ant Users List" <[email protected]> Date: Friday, July 23, 2010, 5:50 AM On Thu, Jul 22, 2010 at 2:13 PM, Vimil Saju <[email protected]> wrote: > > Hi, > I was looking if the copy task had the ability to overwrite read-only files. > The manual says > that if the 'force' attribute is set to true then read-only files will be > overwritten, but it also > says this attribute is available only on ant version 1.8.2. I don't see that > version of ant > for download on the site. Hmmm.... It looks like you may have to get the latest source code and build it yourself, or try the Hudson builds that occur on every source update. It took me a little while to locate them: Ant's Hudson project is at http://hudson.zones.apache.org/hudson/view/Ant/. If you drill down into the build and then the build artifacts, you can find the binaries. I found one here: http://bit.ly/aqWnmM. If that doesn't work, you may have to checkout the source from the Apache Ant's source repository and try building it yourself. The source repository is at: http://ant.apache.org/svn.html The thing you may want to ask yourself is why are you trying to copy over read-only files. In development situations, this is usually a warning that you're trying to do something you shouldn't be doing. For example, you have a revision control system where you have to mark files you want to modify for checking out. (Clearcase where you have to do a "cleartool co" or Perforce where you have to "p4 edit" files). In this case, you're trying to overwrite files that you really don't want to change. If you really do need to overwrite read-only files, and you can't get Ant 1.8.2 to work, you can always use Ant's "exec" command to call the operating system's command to remove the read-only attribute. In Unix/Linux, it is "chmod -R +w". In Windows, it is "attrib -r". You can verify the OS via the "exec" command with the "exec" task's "osfamily" parameter. It can be "unix", "windows" and "mac" (See http://ant-contrib.sourceforge.net/tasks/tasks/osfamily.html for more information about the possible values.). -- David Weintraub [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
