ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Mao <james....@iona.com>
Subject Target.getTasks returns UnknownElement
Date Wed, 01 Aug 2007 11:29:43 GMT
Hi,

I'm trying to parse the build.xml myself, and tried to get the tasks 
object with the following code

        File buildFile = new File("c:/myproject/build.xml");

        Project project = new Project();
        project.init();
        project.setUserProperty( "ant.file" , buildFile.getAbsolutePath());
        project.addBuildListener(new DefaultLogger());
        ProjectHelper.configureProject(project, buildFile);

        Target target = (Target) project.getTargets().get("echome");
        Task[] tasks = target.getTasks();
        System.out.println(((Echo)tasks[0]));   <<< Failure point


The build.xml is

<project name="myproject">
  <target name="echome">
      <echo message="abc"/>
  </target>
</project>


How can i get an instance of Echo , instead of UnknownElement 
<cid:part1.04040006.08090202@iona.com>?

I'm running the above code inside a junit test

ant 1.7.0, junit4, jdk1.6


Thanks in advance!
James

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


Mime
View raw message