diff --git a/docs/manual/CoreTasks/include.html b/docs/manual/CoreTasks/include.html index 8a5e900a9..794c23415 100644 --- a/docs/manual/CoreTasks/include.html +++ b/docs/manual/CoreTasks/include.html @@ -189,6 +189,9 @@ directory.

How is <import> different from <include>?

+

The short version: Use import if you intend to override a target, + otherwise use include.

+

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 @@ -201,16 +204,16 @@ directory.

remains unchanged, i.e. it uses "normal" names and allows you to override targets in the dependency list.

-

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.

+

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.

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.

-

Use import if you intend to override a target, otherwise use include.

+

Examples

nested.xml shall be:

@@ -229,43 +232,53 @@ directory.

When using import like in

-<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>
 
-

Running the target nested.echo will emit: +

Running the build file will emit:

 setUp:
 
 nested.echo:
      [echo] prop has the value in importing
+
+test:
+
 

When using include like in

-<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>
 
-

Running the target nested.echo will emit: +

Running the target build file will emit:

 nested.setUp:
 
 nested.echo:
      [echo] prop has the value in nested
+
+test:
+
 

and there won't be any target named "echo" on the including build file.