Hi,
Currently, we don't use Velocity macros in the templates for generating
sources. At least we can use the macros defined in vm files, although there
is an option for writing Java code for macros (which is less preferred).
I've created https://issues.apache.org/jira/browse/MYFACES-2866 for this
issue.
So, for example, instead of
<tag>
......
#set ($propertyList = ${component.propertyList})
#foreach( $property in $propertyList )
#if (!$property.isTagExcluded())* <attribute>
#if ($property.longDescription)
<description><![CDATA[$property.longDescription]]></description>
................
................
</attribute>
#end*
#end
</tag>
we could've used
<tag>
....
#set ($propertyList = ${component.propertyList})
#foreach( $property in $propertyList )
#if (!$property.isTagExcluded())
*#writeProperty($property)*
#end
</tag>
where writeProperty macro can be defined in vm file, as explained in
http://velocity.apache.org/engine/devel/user-guide.html#Velocimacros
Furthermore, to reuse the macros in different vm files, there is "parse" [1]
directive. But myfaces-builder-plugin must migrate to Velocity 1.6 (see
https://issues.apache.org/jira/browse/MYFACES-2867) to parse the macros in
different vm files.
I checked out the myfaces-build-plugin, applied the mentioned changes
locally, used in generating sources of my GSoC project and worked
flawlessly (not committed yet).
Any concerns at first sight?
[1] http://velocity.apache.org/engine/devel/user-guide.html#Parse
<http://velocity.apache.org/engine/devel/user-guide.html#Parse>Thanks,
Ali
--
My Blog: http://blog.aliok.com.tr
Twitter: http://twitter.com/aliok_tr