How to "inherit" from a target in ant -


i have target of following form

<target name="runtool" depends="build">     <java classname="toolmain" fork="true" clonevm="true" failonerror="true">     <arg......>     <jvmarg.....>     .... </target> 

i want add additional target debug path, has other args same 1 additional arg listen on debug port.

<target name="runtool-debug" depends="build"> ...same program .... ......and same args...... <jvmarg value="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n"/> </target> 

what best way achieve without duplicating entire target?

define property named debug.flag instance , use add additional arguments when set true:

<target name="runtool" depends="build">     <condition property="debug.jvmargs"        value="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n"        else="">           <equals arg1="${debug.flag}" arg2="true" />     </condition>     <java classname="toolmain" fork="true" clonevm="true" failonerror="true">        <arg......>        <jvmarg.....>        <jvmarg value="${debug.jvmargs}" />        .... </target> 

in condition task, when debug.flag true, debug.jvmargs set -agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n, else empty.

to set property true, can run ant -ddebug.flag=true ....


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -