ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey E Care <ca...@us.ibm.com>
Subject Re: Help Running Ant Task from my Custom Task (xmltask)
Date Thu, 18 Aug 2005 19:30:25 GMT
project -> getProject ()
-- 
Jeffrey E. Care (carej@us.ibm.com)
WebSphere v7 Release Engineer
WebSphere Build Tooling Lead (Project Mantis)


"koden (sent by Nabble.com)" <lists@nabble.com> wrote on 08/18/2005 
03:00:07 PM:

> 
> I am using xmltask in my own custom ant task.  I have a couple 
> problems I can't fix.
> 
> 
> I'm not exactly sure how to create a new XmlTask.  I tried: XmlTask 
> xml_edit = (XmlTask) project.createTask("xmltask");
> 
> The Eclipse IDE says the above "project" is depreciated.  What else 
> would I use there?
> 
> I also added a taskdef that was called xmltask to my build.xml for 
> my custom script:
> 
> 
> 
> 
> 
> I'm writing a task called: versionupdatetask, and here's the error I
> get when I run my code:
> 
> [versionupdatetask] java.lang.NullPointerException
> [versionupdatetask]     at src.VersionUpdateTask.updateXML(Unknown 
Source)
> [versionupdatetask]     at src.VersionUpdateTask.do_update(Unknown 
Source)
> [versionupdatetask]     at src.VersionUpdateTask.execute(Unknown Source)
> [versionupdatetask]     at org.apache.tools.ant.UnknownElement.
> execute(UnknownEl
> ement.java:275)
> [versionupdatetask]     at 
org.apache.tools.ant.Task.perform(Task.java:364)
> [versionupdatetask]     at org.apache.tools.ant.Target.
> execute(Target.java:341)
> [versionupdatetask]     at org.apache.tools.ant.Target.
> performTasks(Target.java:
> 369)
> [versionupdatetask]     at org.apache.tools.ant.Project.
> executeSortedTargets(Pro
> ject.java:1216)
> [versionupdatetask]     at org.apache.tools.ant.Project.
> executeTarget(Project.ja
> va:1185)
> [versionupdatetask]     at org.apache.tools.ant.helper.
> DefaultExecutor.executeTa
> rgets(DefaultExecutor.java:40)
> [versionupdatetask]     at org.apache.tools.ant.Project.
> executeTargets(Project.j
> ava:1068)
> [versionupdatetask]     at 
org.apache.tools.ant.Main.runBuild(Main.java:668)
> [versionupdatetask]     at 
org.apache.tools.ant.Main.startAnt(Main.java:187)
> [versionupdatetask]     at org.apache.tools.ant.launch.Launcher.
> run(Launcher.jav
> a:246)
> [versionupdatetask]     at org.apache.tools.ant.launch.Launcher.
> main(Launcher.ja
> va:67)
> [versionupdatetask] update failed.
> 
> What am I doing wrong?  I'm using the attr ability of xmltask.  It's
> basically in this format:
> 
> 
> 
> 
> 
> But using java, I'm doing the following:
> 
> XmlTask xml_edit = (XmlTask) project.createTask("xmltask");
> Attr xml_attr = xml_edit.createAttr();
> xml_attr.setPath(xpath);
> xml_attr.setAttr("value");
> xml_attr.setValue(new_val);
> FileSet xmlSet = new FileSet();
> xmlSet.setFile(new File(file_path));
> xmlSet.setDefaultexcludes(false);
> xml_edit.addFileset(xmlSet);
> xml_edit.execute();
> 
> Problem as you can see, xml_edit (which is an XmlTask) isn't even 
> linked to xml_attr.  So how do I execute the attr function?
> 
> Thanks in advance
> --
> Sent from the Ant - Dev forum at Nabble.com:
> http://www.nabble.com/Help-Running-Ant-Task-from-my-Custom-Task-%
> 28xmltask%29-t235448.html#a658453

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message