Hi everybody,

I need to compile and package many jars (one jar per source folder). Because
I haven't found any task to do that, I have writing my own who extends
org.apache.tools.ant.Task and implements org.apache.tools.ant.TaskContainer.

She work great with tasks like "echo", "mkdir", "copy" but the "javac" task
is never executed. How can I run the "javac" task from a TaskContainer ?

Here is the main code and you can found the full class as attachment.
public void execute() throws BuildException {
        if ( baseDir.isDirectory() ) {
                for (File subdir : baseDir.listFiles(new DirectoryFilter()))
{
                        if ( getProject().getProperty(identifier)==null ) {
                                getProject().setNewProperty(identifier,
subdir.getName());
                        } else {
                                getProject().setProperty(identifier,
subdir.getName());
                        }
        
                        for (Task subtask : tasks) {
                                log("> Run task "+subtask.getTaskName());
                                subtask.perform();
                        }
                }
        } else {
                log("Base directory \""+baseDir+"\". isn't a directory.",
0);
        }
}

And finally the task content :
<foreach
basedir="${manager.location}${file.separator}${manager.moddir}" 
                                        identifier="modulename">
                        <echo level="info">Building module
${modulename}</echo>
                        <mkdir
dir="${modsdir}${file.separator}sicsmod-${modulename}"/>
                        <javac
srcdir="${manager.location}${file.separator}${manager.moddir}${file.separato
r}${modulename}" 
        
destdir="${modsdir}${file.separator}sicsmod-${modulename}" 
        
classpathref="manager.modules.classpath" 
        
classpath="${build}${file.separator}${manager.jarname}"
                                        includes="${manager.modules}/**" 
                                        debug="on" />
                        <!-- Copy each properties files (resources) and
images -->
                        <copy
todir="${modsdir}${file.separator}sicsmod-${modulename}">
                                <fileset
dir="${manager.location}${file.separator}${manager.moddir}${file.separator}$
{modulename}" 
                                                includes="**/*.properties,
**/*.png" />
                        </copy>
                </foreach>

Thanks
 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3912 (20090306) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to