You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Vimil Saju <vi...@yahoo.com> on 2010/07/22 20:13:20 UTC

CopyTask: attribute to overwrite readonly files

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. the latest version of ant that i see on the site is version 1.8.1. Could you let me know if this attribute is present in 1.8.1 version of ant?
ThanksVimil


      

Re: CopyTask: attribute to overwrite readonly files

Posted by Vimil Saju <vi...@yahoo.com>.
Allright, 
I actually did try it out and it isn't present :P. Any idea if there is a version 1.8.2 of ant somewhere to download?



--- On Thu, 7/22/10, Matthew Jaggard <ma...@jaggard.org.uk> wrote:

From: Matthew Jaggard <ma...@jaggard.org.uk>
Subject: Re: CopyTask: attribute to overwrite readonly files
To: "Ant Users List" <us...@ant.apache.org>
Date: Thursday, July 22, 2010, 12:56 PM

If in doubt, try it out!

Sent from my tellingphone.

On Jul 22, 2010 7:13 PM, "Vimil Saju" <vi...@yahoo.com> 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. the latest version of ant that i see on the site is version 1.8.1.
Could you let me know if this attribute is present in 1.8.1 version of ant?
ThanksVimil



      

Re: CopyTask: attribute to overwrite readonly files

Posted by Matthew Jaggard <ma...@jaggard.org.uk>.
If in doubt, try it out!

Sent from my tellingphone.

On Jul 22, 2010 7:13 PM, "Vimil Saju" <vi...@yahoo.com> 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. the latest version of ant that i see on the site is version 1.8.1.
Could you let me know if this attribute is present in 1.8.1 version of ant?
ThanksVimil

Re: CopyTask: attribute to overwrite readonly files

Posted by Vimil Saju <vi...@yahoo.com>.
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 <qa...@gmail.com> wrote:

From: David Weintraub <qa...@gmail.com>
Subject: Re: CopyTask: attribute to overwrite readonly files
To: "Ant Users List" <us...@ant.apache.org>
Date: Friday, July 23, 2010, 5:50 AM

On Thu, Jul 22, 2010 at 2:13 PM, Vimil Saju <vi...@yahoo.com> 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
qazwart@gmail.com

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




      

Re: CopyTask: attribute to overwrite readonly files

Posted by David Weintraub <qa...@gmail.com>.
On Thu, Jul 22, 2010 at 2:13 PM, Vimil Saju <vi...@yahoo.com> 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
qazwart@gmail.com

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