ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Re: <comment> task
Date Thu, 08 Jan 2004 17:32:53 GMT
Dominique Devienne wrote:

>>From: Jose Alberto Fernandez [mailto:jalberto@cellectivity.com]
>>
>>>Hey Peter, can't you code that? ;-) --DD
>>
>>It already exists, it is called velocity. ;-)
> 
> 
> I always thought velocity was a templating tool,
> so I don't see it's relation to calling arbitrary methods
> on objects referred to from Ant references... --DD

It's just the velocity property stuff that's really used here.
Here is the example of all this stuff.

From:
http://cvs.apache.org/viewcvs.cgi/ant/proposal/embed/test.xml?view=markup

<target name="dynamicProperties" depends="init">
   <taskdef classname="org.apache.tools.ant.taskdefs.optional.JXPath"
              name="jxpath" />
   <taskdef classname="org.apache.tools.ant.taskdefs.optional.JXPathSet"
              name="jxpathSet" />
   <taskdef 
classname="org.apache.tools.ant.taskdefs.optional.VelocityProperties"
              name="velocityProperties" />
   <taskdef 
classname="org.apache.tools.ant.taskdefs.optional.JexlProperties"
              name="jexlProperties" />

     <!-- Init JxPath. '/' is the project -->
     <jxpath/>
     <velocityProperties/>
     <jexlProperties/>

     <echo id="foo" message="Starting dynamic props tests" />

     <echo message="Value: ${vm:$ant.references.jxpathTask.foo}" />
     <jxpathSet path="/references[@name='jxpathTask']/foo" value="Test"/>
     <echo message="Value: ${vm:$ant.references.jxpathTask.foo}" />

     <echo message="${jexl:ant.references.jxpathTask.foo=bar}" />
     <echo message="Value: ${vm:$ant.references.jxpathTask.foo}" />

     <echo
      message="jexl /references/myJars: ${jexl:ant.references.myJars}" />

     <echo message="jxPath /targets[1]: ${jxpath:/targets[1]}" />
     <echo message="jxPath /references: ${jxpath:/references}" />
     <echo message="jxPath /references[@name='myJars']: 
${jxpath:/references[@name='myJars']}" />
     <echo message="jxPath /references/myJars: 
${jxpath:/references/myJars}" />

     <!-- This is XMLDOM.java - a datatype that holds an xml DOM  -->
     <typedef name="xmldom"
              classname="org.apache.tools.ant.taskdefs.XMLDOM"/>

     <!-- Init XMLDOM. The DOM of file test.xml will be referenced via
          the id-->
     <xmldom id="test.xml" file="test.xml"/>

     <echo
  message="XMLDOM: ${jxpath:/references/test.xml/root/project/@name}" />

   </target>


-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


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


Mime
View raw message