ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Patternset - overriding previous definition problem
Date Wed, 01 May 2002 18:20:19 GMT
Well, I don't think you are doing anything wrong, I just wouldn't do it the
same way ;-) By that I mean that you either define your <patternset> outside
<copy> with an id, and refid it from <copy>, or you define it locally inside
<copy> and thus don't need to assign it an id. So I'd do either:

<project name="test" default="clean" basedir=".">
    <target name="clean" description="clean package">
        <delete>
            <fileset dir="."
                     includes="name="**/*.class" />
        </delete>
    </target>
</project>

or

<project name="test" default="clean" basedir=".">
    <patternset id="all_class_files">
        <include name="**/*.class" />
    </patternset>

    <target name="clean" description="clean package">
        <delete>
            <fileset dir=".">
                <patternset refid="all_class_files" />
            </fileset>
        </delete>
    </target>
</project>

the second form being better if you indeed use that same <patternset> in a
<copy> or <move> task in the same build file (or any other task using the
<patternset>. Otherwise the first is better IMHO.

By thinking about it, a clean target usually deletes the directory
containing the classes rather than the classes individually as you seem to
be doing. Then again, your <fileset> starts from "." instead of a usually
classes directory (classes/ or lib/classes/), so you might be doing
something not that usual.

--DD

-----Original Message-----
From: Charles Meyer [mailto:cmeyer@CJ.COM] 
Sent: Tuesday, April 30, 2002 8:16 PM
To: ant-user@jakarta.apache.org
Subject: Patternset - overriding previous definition problem

With a build.xml file such as the following

<project name="test" default="clean" basedir=".">

    <target name="clean" description="clean package">
        <delete>
            <fileset dir=".">
                <patternset id="all_class_files">
                    <include name="**/*.class" />
                </patternset>
            </fileset>
        </delete>
    </target>

</project>

when it is run you receive the message "Overriding previous definition of
reference to all_class_files" which is not the case. I have used this same
style patternset within copy rather than delete blocks and not gotten this
message. Am I doing something wrong or is this a bug?

Charles Meyer

----------------------------------------------------------------------------
-------------------------------------
Commission Junction - The Largest Pay-For-Performance Ad Network.
cmeyer@cj.com     
www.cj.com
Ph: 805 560-0777
Fax: 805 560-0776


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

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


Mime
View raw message