Note that there are some explanatory texts on larger screens.

plurals
  1. POAnt propertyset inheritance with nested tasks
    primarykey
    data
    text
    <p>I have a set of nested Ant build files, and I need to control which properties are inherited by each "sub" task. I'm trying to define these as propertysets (to keep the code manageable) but these are not inherited by subtasks, unlike properties.</p> <p>The example below demonstrates the problem, <code>foo.*</code> get copied into the middle project but not to the bottom project. If I define each property to be inherited explicitly, like <code>bar.*</code>, they get inherited by the bottom project too.</p> <p>Is there any way to get a group of properties to inherit all the way down, in the same way individual properties do? Without rewriting the sub-processes, is there something else I could try?</p> <p>[top.xml]</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project name="test-top"&gt; &lt;property name="foo.1" value="1"/&gt; &lt;property name="foo.2" value="2"/&gt; &lt;property name="bar.1" value="1"/&gt; &lt;property name="bar.2" value="2"/&gt; &lt;ant antfile="middle.xml" inheritall="false"&gt; &lt;propertyset&gt; &lt;propertyref prefix="foo."/&gt; &lt;/propertyset&gt; &lt;property name="bar.1" value="${bar.1}"/&gt; &lt;property name="bar.2" value="${bar.2}"/&gt; &lt;/ant&gt; &lt;/project&gt; </code></pre> <p>[middle.xml]</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project name="test-middle"&gt; &lt;echo&gt;foo ${foo.1} ${foo.2}&lt;/echo&gt; &lt;echo&gt;bar ${bar.1} ${bar.2}&lt;/echo&gt; &lt;ant antfile="bottom.xml" inheritall="false"/&gt; &lt;/project&gt; </code></pre> <p>[bottom.xml]</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project name="test-bottom"&gt; &lt;echo&gt;foo ${foo.1} ${foo.2}&lt;/echo&gt; &lt;echo&gt;bar ${bar.1} ${bar.2}&lt;/echo&gt; &lt;/project&gt; </code></pre> <p>[OUTPUT OF ant -f top.xml]</p> <pre><code> [echo] foo 1 2 [echo] bar 1 2 [echo] foo ${foo.1} ${foo.2} [echo] bar 1 2 </code></pre>
    singulars
    1. This table or related slice is empty.
    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. 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