Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Rather than <code>depend</code>ing on task C, you could use the <a href="http://ant.apache.org/manual/Tasks/antcall.html" rel="nofollow">Antcall</a> task to pass the <code>B</code> argument as a <code>param</code>.</p> <pre><code>&lt;target name="A" &gt; &lt;antcall target="C" /&gt; .... &lt;/target&gt; &lt;target name="B" &gt; &lt;antcall target="C" &gt; &lt;param name="extra_arg" value="xxx" /&gt; &lt;/antcall&gt; ... &lt;/target&gt; &lt;target name="C"&gt; &lt;java fork="true" ...&gt; &lt;jvmarg .../&gt; &lt;arg .../&gt; &lt;arg .../&gt; &lt;arg value="${extra_arg}"/&gt; &lt;/java&gt; &lt;/target&gt; </code></pre> <p>EDIT: As Nico points out in the comment, this doesn't work if the value is unset from A. The answer can be extended to use the <code>condition</code> task to set the argument to a null string.</p> <pre><code>&lt;condition property="argToUseIfFromB" else=""&gt; &lt;isset property="extra_arg" /&gt; &lt;/condition&gt; &lt;java fork="true" ...&gt; &lt;jvmarg .../&gt; &lt;arg .../&gt; &lt;arg .../&gt; &lt;arg value="${argToUseIfFromB}"/&gt; &lt;/java&gt; </code></pre> <p>FURTHER EDIT: Since we can't get the arguments to be recognised as optional, we can pass in the whole command line from each parent task. Target <code>A</code> would only pass the common arguments; <code>B</code> would pass through an extra argument. The Ant manual on <a href="http://ant.apache.org/manual/using.html#arg" rel="nofollow">arguments</a> explains it better than me.</p> <pre><code>&lt;target name="A" &gt; &lt;antcall target="C"&gt; &lt;param name="java_args" value="arg_a arg_b" /&gt; &lt;/antcall&gt; .... &lt;/target&gt; &lt;target name="B" &gt; &lt;antcall target="C" &gt; &lt;param name="java_args" value="arg_a arg_b extra_arg" /&gt; &lt;/antcall&gt; ... &lt;/target&gt; &lt;target name="C"&gt; &lt;java fork="true" ...&gt; &lt;jvmarg .../&gt; &lt;arg line="${java_args}"/&gt; &lt;/java&gt; &lt;/target&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload