You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2003/07/11 15:46:48 UTC

DO NOT REPLY [Bug 21511] New: - Custom file selectors have no project instance.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21511>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21511

Custom file selectors have no project instance.

           Summary: Custom file selectors have no project instance.
           Product: Ant
           Version: 1.5.3
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: brunner@pixel.de


Custom file selectors for file sets can't use their project member (e.g. for
logging or for resolving properties) as it is always null.

Provided a minimum example below.

Bye Rudi

-------------------------- Java code --------------------------
package my.selector;

import org.apache.tools.ant.types.selectors.BaseSelector;
import java.io.File;

public class MySelector extends BaseSelector
{
    public boolean isSelected(File file, String s, File file1)
    {
        System.out.println("project = " + project);
        return true;
    }
}
---------------------------------------------------------------

-------------------------- Ant build file ---------------------
<?xml version="1.0" encoding="UTF-8"?>

<project name="MySelector" default="compile">

    <property name="classesdir" value="classes" />
    <property name="srcdir" value="src" />

    <target name="test">
        <zip destfile="test.zip">
            <fileset dir="${srcdir}" includes="**/*.java">
                <custom classname="my.selector.MySelector"
classpath="${classesdir}"/>
            </fileset>
        </zip>
    </target>

    <target name="compile">
        <mkdir dir="${classesdir}"/>
        <javac srcdir="${srcdir}" destdir="${classesdir}"/>
    </target>

    <target name="clean">
        <delete dir="${classesdir}" />
    </target>

</project>
---------------------------------------------------------------

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