I would like to call a macro from inside an element of another macro. Let's suppose I have the following macro:
<macrodef name="jc">
<attribute name="name" />
<attribute name="destdir" />
<element name="fileset-list" optional="false" />
<sequential>
<jar destfile="@{destdir}${file.separator}@{name}.jar" update="false">
<fileset-list />
<manifest>
<attribute name="Manifest-Version" value="1.0" />
</manifest>
</jar>
</sequential>
</macrodef>
and another macro
<macrodef name="defaultfs" description="Defines the default fileset">
<attribute name="path" />
<sequential>
<fileset dir="${dir.build.classes}">
<include name="@{path}/**/*.class" />
</fileset>
<fileset dir="${src.ehs}">
<include name="@{path}/**/icons/**" />
<include name="@{path}/**/sounds/**" />
<include name="@{path}/**/*.gif" />
<include name="@{path}/**/*.png" />
<include name="@{path}/**/*.wav" />
<include name="@{path}/**/*.jpg" />
<include name="@{path}/**/*.properties" />
<include name="@{path}/**/*.xml" />
<include name="@{path}/**/jaxb.index" />
</fileset>
</sequential>
</macrodef>
I use these macros as follow:
<jc destdir="${dir.build.jar}" name="thejar">
<fileset-list>
<defaultfs path="org/path/inner" />
</fileset-list>
</jc>
What I get is the following error message:
jar doesn't support the nested "defaultfs" element.
What is wrong?
You could try making macro call within your main macro 'jc' and pass fileset path to consider as an additional attribute
And then your main macro call could look like :
(not tested, you could give it a try )