ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 26871] New: - allow many default.properties files to make loading of extending tasks easier
Date Wed, 11 Feb 2004 20:40:35 GMT
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=26871>.
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=26871

allow many default.properties files to make loading of extending tasks easier

           Summary: allow many default.properties files to make loading of
                    extending tasks easier
           Product: Ant
           Version: 1.6.0
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: emaus@nr.no


There are two ways to extend and with custom tasks. One is using <taskdef> in 
yout build file, which is a little awkward for tasks you use a lot and usually 
breaks ant-support in editors. 

The other is to open ant.jar, modify the definition file
org/apache/tools/ant/tasdefs/default.properties
and then wrap it all up again. This is cumbersome and not so easy.

I suggest making it possible for all jars in classpath to have a task definition 
file named as above. Then new tasks can be loaded by placing the jar file in 
ant/lib, and voila! ant finds the new task. 

The ant core must be changed to not only look for one item in the class path 
with the def-file name, but to look for all resources with that name. AFAIK, the 
following change will implement the suggestion:

File: apache-ant-1.6.0/src/main/org/apache/tools/ant/ComponentHelper.java
Method: private void initTasks() {....}
modified code starting at line 732


            /* replaced code:
            in = this.getClass().getResourceAsStream(dataDefs);
            if (in == null) {
                throw new BuildException("Can't load default task list");
            }
            props.load(in);
            */
            // replacement begin
            Enumeration enumeration = this.getClass()
                            .getClassLoader().getResources(dataDefs);
            while (enumeration.hasMoreElements()) {
                URL url = (URL) enumeration.nextElement();
                in = url.openStream();
                props.load(in);
            }
            // end of replacement

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


Mime
View raw message