I am working on some code block on Apache ANT
<target name="workload">
<script language="javascript"><![CDATA[
println("<div id='collapseOne' class='accordion-body collapse in'><div class='accordion-inner'><pre>"); ]]>
</script>
<apply dir="${dir.publish.ini}" executable="java" parallel="false" failonerror="false">
<fileset dir="${dir.ini}">
<include name="**/*.ini"/>
</fileset>
<arg value="-jar" />
<arg path="${tool}" />
<srcfile/>
</apply>
<script language="javascript"><![CDATA[ println("</pre></div></div>"); ]]></script>
</target>
When i use <antcall target="workload"/>
It's working fine.
I have to optimize this code block. So i tried using following code:
<macrodef name="workload">
<script language="javascript"><![CDATA[
println("<div id='collapseOne' class='accordion-body collapse in'><div class='accordion-inner'><pre>"); ]]>
</script>
<apply dir="${dir.publish.html}" executable="java" parallel="false" failonerror="false">
<fileset dir="${dir.ini}">
<include name="**/*.ini"/>
</fileset>
<arg value="-jar" />
<arg path="${tool}" />
<srcfile/>
</apply>
<script language="javascript"><![CDATA[ println("</pre></div></div>"); ]]></script>
</macrodef>
And when i called <antcall target="workload"/> It showed me the following error:
macrodef doesn't support the nested "script" element.
Which it macrodef does not support script! How can overcome this? or Is there any better way to optimize my build.xml code block?
You are converting task inside target to macrodef for reuse. In that case, capture the logic inside sequential block of macrodef.
http://ant.apache.org/manual/Tasks/macrodef.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With