ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy-Lambert <anto...@antbuild.com>
Subject AW: little help please...Exception:Class org.apache.tools.ant.UnknownElement doesn't support the "name" attribute
Date Thu, 18 Sep 2003 16:31:07 GMT
Here is a sample of how you can use the ant api to run targets.
I am not using the AntTarget class here, just the Project class.
Maybe this makes a difference.
Cheers,
Antoine
public class testjartask {
    public static void main (String [] argv){

        //String filename="/dev/testant/build.xml";
        String
filename="/dev/gnu/ant/jakarta-ant/src/etc/testcases/taskdefs/jar.xml";
        StringBuffer logBuffer;
        StringBuffer fullLogBuffer;
        Project project=new Project();
        logBuffer = new StringBuffer();
        fullLogBuffer = new StringBuffer();
        project = new Project();
        project.init();
        project.setUserProperty( "ant.file" , new
File(filename).getAbsolutePath() );
        ProjectHelper.configureProject(project, new File(filename));
        project.addBuildListener(createLogger());
        //project.executeTarget("cleanup");
        project.executeTarget("test4");
        project.executeTarget("testRecreateNewerFileSetup");
        project.executeTarget("testRecreateWithUpdateNewerFile");
    }
    private static BuildLogger createLogger() {
        BuildLogger logger = null;
        logger = new DefaultLogger();
        logger.setMessageOutputLevel(Project.MSG_INFO);
        logger.setOutputPrintStream(System.out);
        logger.setErrorPrintStream(System.err);
        logger.setEmacsMode(false);

        return logger;
    }
}

-----Ursprungliche Nachricht-----
Von: teoman teoman [mailto:teoman872@yahoo.com]
Gesendet: Donnerstag, 18. September 2003 17:56
An: user@ant.apache.org
Betreff: little help please...Exception:Class
org.apache.tools.ant.UnknownElement doesn't support the "name" attribute


hi all,

I am calling an ant build file from a java class...first I am loading the
build file into my project object:

           Project oProject  = new AntTarget();
           File    buildFile = new File(file);
           oProject.setUserProperty("ant.file",buildFile.getAbsolutePath());
           ProjectHelper.configureProject(oProject,buildFile);
           oProject.executeTarget(target);//executes the specified target

and I am getting exception like that:
Sep 18, 2003 10:47:12 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=2/59
config=/export/home/amustaco/jakarta-tomcat-4.1.18/conf/jk2.properties
runTarget Exception:Class org.apache.tools.ant.UnknownElement doesn't
support the "name" attribute.
Class org.apache.tools.ant.UnknownElement doesn't support the "name"
attribute.
 at
org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.ja
va:422)


thank you so much in advance..
teoman




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


Mime
View raw message