Built a quick test myself:
<project name="test" default="test" basedir=".">
<target name="test">
<delete>
<fileset dir="${basedir}">
<exclude name="build.xml"/>
<exclude name="src/**"/>
</fileset>
</delete>
</target>
</project>
This works great -- except it doesn't delete directories. Filesets
delete files, not directories. However, adding a "includeemptydirs"
parameter to the delete task seems to do the job:
"<project name="test" default="test" basedir=".">
<target name="test">
<delete
includeemptydirs="true">
<fileset dir="${basedir}">
<exclude name="build.xml"/>
<exclude name="src/**"/>
</fileset>
</delete>
</target>
</project>
One hint which will make things easier in the future: Build everything
under a single directory. As a standard at my work, we put everything
created by the antfile under the "_build" directory: All tests,
javadocs, *.class files, etc. That way, I can clean up by just
deleting "_build".
--
David Weintraub
[EMAIL PROTECTED]
On Mon, Jun 16, 2008 at 10:57 AM, Tim Visher <[EMAIL PROTECTED]> wrote:
> Partially solved my own problem at this point. No longer getting
> NullPointer but I still can't get the right includes. My syntax must
> be off or something. Good news is that the exclude seems to be
> working.
>
> Current target contents:
> <target name="clean" depends="init" >
> <delete>
> <fileset dir="." includes="**/*">
> <exclude name="build.xml" />
> <exclude name="test.xml" />
> <exclude name="src/*" />
> <exclude name="test/*" />
> </fileset>
> </delete>
> </target>
>
> On Mon, Jun 16, 2008 at 10:46 AM, Tim Visher <[EMAIL PROTECTED]> wrote:
>> Hey Everyone,
>>
>> I'm trying to develop a clean target that essentially deletes
>> everything but a given set of files, rather than explicitly specifying
>> everything to delete. This seems like a slightly more elegant
>> solution than the alternative, but I'm having very little success at
>> the moment. I've included the contents of the clean target here
>> (since it's pretty small at the moment). Any help would be greatly
>> appreciated.
>>
>> Now:
>> <target name="clean" depends="init" >
>> <delete failonerror="false">
>> <fileset>
>> <not>
>> <filename name="build.xml" />
>> <filename name="test.xml" />
>> <filename name="src/*" />
>> <filename name="tests/*" />
>> </not>
>> </fileset>
>> </delete>
>> </target>
>>
>> Former:
>> <target name="clean" depends="init" >
>> <delete dir="${build}" />
>> <delete dir="${dist}" />
>> <delete dir="${doc}" />
>> <delete dir="${tests:out}" />
>> <delete dir="${tests:reports}" />
>> </target>
>>
>> FYI: I'm actually failing on an error, a Null Pointer Exception to be
>> exact. So it's not only not deleting the desired fileset; it's not
>> even executing.
>>
>> --
>>
>> In Christ,
>>
>> Timmy V.
>>
>> http://burningones.com/
>> http://five.sentenc.es/ - Spend less time on e-mail
>>
>
>
>
> --
>
> In Christ,
>
> Timmy V.
>
> http://burningones.com/
> http://five.sentenc.es/ - Spend less time on e-mail
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]