I should really get the ant source and figure out what the problem is.
Sounds like a timing hole? Maybe they are threading the delete? In lieu of
that, here is my modified solution:
<project name="prj">
<target name="cleanBuildDirs">
<exec program="cmd" commandline="/c rmdir ..\dir1 /s /q"
if="${directory::exists('..\dir1')}"/>
<exec program="cmd" commandline="/c rmdir ..\dir1 /s /q"
if="${directory::exists('..\dir1')}"/>
<!-- etc -->
<delete file="..\file1"/>
<!-- etc -->
</target>
</project>
This seems to work fine.
Scott
On Fri, Jan 23, 2009 at 2:17 AM, Ruben Willems <[email protected]>wrote:
> Hi
>
>
> I have the same problem, but no solution yet
> the problem is I can not reproduce it, it appearas now and than, but the
> real cause...
>
> I was thinking in placing it inside a loop or so,
> and try 3 times, when I got 3 errors , let the failure go through.
>
> lame solution, but I think it will work.
>
>
> with kind regards
> Ruben Willems
>
>
>
> Fri, Jan 23, 2009 at 5:30 AM, Scott Vickery <[email protected]>wrote:
>
>> Ok, I know this is not the NAnt mailing list, but, thought someone here
>> might have seen this problem. I have an nant task set up something like
>> this:
>> <nant>
>> <executable>C:\Program
>> Files\nant-0.85\bin\NAnt.exe</executable>
>> <baseDirectory>.\Build\</baseDirectory>
>> <buildFile>someBuild.build</buildFile>
>> <targetList>
>> <target>cleanBuildDirs</target>
>> </targetList>
>> </nant>
>>
>> The ant build looks something like this:
>> <project name="Online">
>> <target name="cleanBuildDirs">
>> <delete dir="..\dir1" if="${directory::exists('..\dir1')}"/>
>> <delete dir="..\dir2" if="${directory::exists('..\dir2')}"/>
>> <delete dir="..\dir3" if="${directory::exists('..\dir3')}"/>
>> <delete dir="..\dir4" if="${directory::exists('..\dir4')}"/>
>> <delete dir="..\dir5" if="${directory::exists('..\dir5')}"/>
>> <delete dir="..\dir6" if="${directory::exists('..\dir6')}"/>
>> <delete dir="..\dir7" if="${directory::exists('..\dir7')}"/>
>> <delete dir="..\dir8" if="${directory::exists('..\dir8')}"/>
>> <delete dir="..\dir9" if="${directory::exists('..\dir9')}"/>
>> <delete file="..\Project.sln"/>
>> </target>
>> </project>
>>
>> Every now and then I get an error from ant complaining that "The directory
>> is not empty". Here is part of the Nant stack trace:
>>
>> ber><columnnumber>10</columnnumber></location><stacktrace><![CDATA[ at
>> NAnt.Co
>> re.Tasks.DeleteTask.RecursiveDeleteDirectory(String path)
>> at NAnt.Core.Tasks.DeleteTask.ExecuteTask()
>> at NAnt.Core.Task.Execute()
>> at NAnt.Core.Target.Execute()
>> at NAnt.Core.Project.Execute(String targetName, Boolean
>> forceDependencies)
>> at NAnt.Core.Project.Execute()
>> at
>> NAnt.Core.Project.Run()]]></stacktrace><internalerror><type>System.IO.IOException</type><message><![CDATA[The
>> directory is not empty.
>>
>> This causes my build to fail. But, more importantly, even if I ignored
>> the error, the source is not getting deleted. Has anyone seen this and/or
>> have any suggestions regarding fixing it?
>>
>> Thanks,
>> Scott Vickery
>>
>>
>>
>> On Wed, Jan 21, 2009 at 9:27 PM, Scott Vickery
>> <[email protected]>wrote:
>>
>>> Great. That is what I was looking for.
>>>
>>> Thanks,
>>> Scott
>>>
>>>
>>> On Wed, Jan 21, 2009 at 9:22 PM, Sam Calder <[email protected]>wrote:
>>>
>>>> Better yet, use the NAnt 'if' attribute of the <delete> task with the
>>>> 'directory::exists' function to check if the directory exists first... that
>>>> way it won't error out at all.
>>>>
>>>> Syntax is something like:
>>>>
>>>> <delete dir="test" if="${directory::exists('test')}" />
>>>>
>>>> Cheers,
>>>>
>>>> - Sam.
>>>>
>>>>
>>>>
>>>> On Wed, Jan 21, 2009 at 7:53 PM, Craig Sutherland <
>>>> [email protected]> wrote:
>>>>
>>>>>
>>>>> Do the same thing but put the delete in an NAnt or MSBuild script -
>>>>> this way you could get it to ignore any errors.
>>>>>
>>>>> The mailing list is moderated, hence will be a delay until someone
>>>>> moderates the message.
>>>>>
>>>>>
>>>>> Craig
>>>>>
>>>>> On Jan 22, 6:11 am, Scott <[email protected]> wrote:
>>>>> > I have searched around for a solution to this, but, not found an
>>>>> > answer yet.
>>>>> >
>>>>> > I want to do a clean build every time I build. According to this,
>>>>> http://jira.public.thoughtworks.org/browse/CCNET-1256,
>>>>> > <cleanCopy>True</cleanCopy> for <sourcecontrol type="svn"> is not in
>>>>> a
>>>>> > CC build yet. As a work around, I decided to do this:
>>>>> >
>>>>> > <prebuild>
>>>>> > <exec>
>>>>> > <executable>cmd</executable>
>>>>> > <buildArgs>/c rmdir /s /q c:\buildFolder\code\trunk
>>>>> > \projectFolder</buildArgs>
>>>>> > </exec>
>>>>> > </prebuild>
>>>>> >
>>>>> > This work fine if the folder exists. But, the first time the project
>>>>> > is built, before the code is checked out, the build fails with "The
>>>>> > system cannot find the file specified." How can I get CC to ignore
>>>>> > that error?
>>>>> >
>>>>> > Thanks,
>>>>> > Scott Vickery
>>>>>
>>>>
>>>>
>>>
>>
>