Andrew, from my not so extensive usage of <import> I
know that targets in the importee overload targets in
imported. It is like extending a class in Java and
calling a method defined in the base class results in
a call to a method in the child class. (The imported
is like a base class and the importee is like a child
class).
You can however do what you want. You have to rewrite
project name="imported-test" like this:
<project name="imported-test" default="imported"
basedir=".">
<target name="imported" depends="imported-test.test"
>
<echo message="In imported target" />
</target>
<target name="test">
<echo message="target 'test' in imported-test
progect" />
</target>
</project>
Please, note the depends clause of target
name="imported". It states that it depends on target
test in a project named imported-test, i.e. on "test"
target in imported.xml. You could read this in [1],
section Target Overriding.
I am curious why you want to switch off target
overriding. I am writing some ant scripts for our
project and use it quite a lot to reuse code.
HTH Ivan
[1]http://ant.apache.org/manual/CoreTasks/import.html
--- Andrew Solonchuk <[EMAIL PROTECTED]> wrote:
>
> Hi I've tested <import> for using in my build file
> and don't
> understood some thing
>
> if i have
> <project name="import-test" default="main"
> basedir=".">
> <import file="imported.xml"/>
> <target name="main">
> <echo message="In main"/>
> <antcall target="imported"/>
> </target>
> <target name="test">
> <echo message="target 'test' in import-test
> progect" />
> </target>
> </project>
>
> <project name="imported-test" default="imported"
> basedir=".">
> <target name="imported" depends="test" >
> <echo message="In imported target" />
> </target>
> <target name="test">
> <echo message="target 'test' in imported-test
> progect" />
> </target>
> </project>
>
> I have output
> Buildfile: import.xml
> main:
> [echo] In main
> test:
> [echo] target 'test' in import-test progect
> imported:
> [echo] In imported target
>
>
> But I need if target name="imported" depends="test"
> to be executed
> "test" from file where demends where declared,...
> not having
> overloading target.
>
> How to do that? or import is simply include and not
> more?
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]