Hello-

I'm using Ant version 1.6.5 and I'm trying to use the import task.  The
manual shows that in the imported file, ant.file.imported should be set,
however I'm not seeing this property.
http://ant.apache.org/manual/CoreTasks/import.html

I wrote the attached little task to display the properties that are set and
optionally write them to a file.

Any ideas why that property is not being set?

Thanks,
--jah
package com.heddway.ant;

import java.io.*;
import java.util.*;

import org.apache.tools.ant.*;
import org.apache.tools.ant.types.*;

/**
 * Provides a task to Ant that prints all current properties to stdout.
 */
public class PrintPropertiesTask extends Task {
    /** An optional file to write the properties to. */
    private String file;

    ////////////////////////////////////////////////////////////////////////////////

    /** Called to execute the task. */
    public void execute() throws BuildException {
        Properties props = System.getProperties();

        try {
            if (file == null) {
                props.list(System.out);
            } else {
                String comments = "GENERATED BY " + getClass().getName();
                props.save(new FileOutputStream(file), comments);
            }

        } catch (java.io.IOException ioe) {
            throw new BuildException(ioe);
        }
    }

    ////////////////////////////////////////////////////////////////////////////////

    /**
     * Sets an optional file to write the properties to.
     * @param file the file to write to
     */
    public void setFile(String file) { this.file = file; }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to