You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2008/11/12 13:16:28 UTC
svn commit: r713353 - /ant/core/trunk/docs/manual/CoreTasks/import.html
Author: bodewig
Date: Wed Nov 12 04:16:27 2008
New Revision: 713353
URL: http://svn.apache.org/viewvc?rev=713353&view=rev
Log:
adapt to Dominique's feedback
Modified:
ant/core/trunk/docs/manual/CoreTasks/import.html
Modified: ant/core/trunk/docs/manual/CoreTasks/import.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/import.html?rev=713353&r1=713352&r2=713353&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/import.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/import.html Wed Nov 12 04:16:27 2008
@@ -193,6 +193,9 @@
<h3>How is <import> different
from <a href="include.html"><include></a>?</h3>
+<p>The short version: Use import if you intend to override a target,
+ otherwise use include.</p>
+
<p>When using import the imported targets are available by up to two
names. Their "normal" name without any prefix and potentially with
a prefixed name (the value of the as attribute or the imported
@@ -205,16 +208,16 @@
remains unchanged, i.e. it uses "normal" names and allows you to
override targets in the dependency list.</p>
-<p>When using include, the included target's depends attribute is
- rewritten so that prefixed names are used. This allows writers of
- the included file to control which target is invoked as part of the
- dependencies.</p>
+<p>When using include, the included targets cannot be overridden and
+ their depends attributes are rewritten so that prefixed names are
+ used. This allows writers of the included file to control which
+ target is invoked as part of the dependencies.</p>
<p>It is possible to include the same file more than once by using
different prefixes, it is not possible to import the same file more
than once.</p>
-<p>Use import if you intend to override a target, otherwise use include.</p>
+<h4>Examples</h4>
<p><i>nested.xml</i> shall be:</p>
@@ -233,43 +236,53 @@
<p>When using import like in</p>
<pre>
-<project>
+<project default="test">
<target name="setUp">
<property name="prop" value="in importing"/>
</target>
<import file="nested.xml" as="nested"/>
+
+ <target name="test" depends="nested.echo"/>
</project>
</pre>
-<p>Running the target <i>nested.echo</i> will emit:
+<p>Running the build file will emit:
<pre>
setUp:
nested.echo:
[echo] prop has the value in importing
+
+test:
+
</pre>
<p>When using include like in</p>
<pre>
-<project>
+<project default="test">
<target name="setUp">
<property name="prop" value="in importing"/>
</target>
<include file="nested.xml" as="nested"/>
+
+ <target name="test" depends="nested.echo"/>
</project>
</pre>
-<p>Running the target <i>nested.echo</i> will emit:
+<p>Running the target build file will emit:
<pre>
nested.setUp:
nested.echo:
[echo] prop has the value in nested
+
+test:
+
</pre>
<p>and there won't be any target named "echo" on the including build file.</p>