You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ja...@rzf.fin-nrw.de on 2008/12/01 07:03:40 UTC

AW: Target overriding inside imported files.

>I'm working with Eclipse and I have auto generated the 
>build.xml file. There
>is a way to automatically import your own buildfiles by adding
><?eclipse.ant.import?> on the top.
>My question: ¿Is it possible to override the definition of a 
>target in order
>to specify the dependencies?
>Let's say for example:
>
>
><!-- Eclipse automatically generated build.xml file -->
><project ...
>...
><import file="build.proxies.xml"/>
>...
>...
><target depends="build-subprojects,build-project" name="build"/>
>...
><!-- End of Eclipse automatically generated build.xml file -->
>
>---------------------------------------------------------------
>-------------------------------
>
><!-- My own build.proxies.xml file -->
><project ...
>...
>
><!-- Override the target to add the dependency of build -->
><target depends="generateproxies" name="build" />
>
><target name="generateproxies">
>    <!-- generate the proxies for the project -->
></target>
>
><!-- End of my own build.proxies.xml file -->
>
>
>
>Or, do you have any other suggestion in order no to modify the main
>build.xml file every time?


You can overwrite targets and its dependencies.
You can access the overwritten targets by "full qualified names" ${AntProjectName.TargetName}.
In your case your "build" eliminates the dependency on "build-subprojects,build-project".

<!-- Eclipse automatically generated build.xml file -->
<project name="foo" ...
    <target depends="build-subprojects,build-project" name="build"/>
    ...
<!-- End of Eclipse automatically generated build.xml file -->
<!-- My own build.proxies.xml file -->
<project name="myfoo" ...
    <!-- Override the target to add the dependency of build -->
    <target depends="generateproxies,foo.build" name="build" />
    ....
<!-- End of my own build.proxies.xml file -->



Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: AW: Target overriding inside imported files.

Posted by "Alexander L." <fe...@yandex.ru>.
Hi,

Although this is quite old topic, let me add two cents since I'd been guided
by it when faced the same trouble.

The initial question mentioned using
<?eclipse.ant.import?> on the top of the manual edited file
which assumes that main build file (passed to Ant and from which default
"build" target is invoked) is generated by Eclipse (build.xml). Such
build.xml in turn automatically imports user's build file:
><import file="build.proxies.xml"/> 

The solution proposed above makes user's build file the main one (and
generated build file becomes included).
Thus the feature of automatic importing files annotated with
"<?eclipse.ant.import?>" is not used.
That is what wasn't mentioned and had me to stop and think :) 

Please correct me if I am wrong, but I've tried the way where
"build.proxies.xml" was included one and referred to "foo.build", and that
way Ant didn't work well.

-- 
View this message in context: http://www.nabble.com/Target-overriding-inside-imported-files.-tp20737999p25530419.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Target overriding inside imported files.

Posted by Alfredo Perez <al...@perseum.com>.
Thank you very  much Jan

2008/12/1 <Ja...@rzf.fin-nrw.de>

> >I'm working with Eclipse and I have auto generated the
> >build.xml file. There
> >is a way to automatically import your own buildfiles by adding
> ><?eclipse.ant.import?> on the top.
> >My question: ¿Is it possible to override the definition of a
> >target in order
> >to specify the dependencies?
> >Let's say for example:
> >
> >
> ><!-- Eclipse automatically generated build.xml file -->
> ><project ...
> >...
> ><import file="build.proxies.xml"/>
> >...
> >...
> ><target depends="build-subprojects,build-project" name="build"/>
> >...
> ><!-- End of Eclipse automatically generated build.xml file -->
> >
> >---------------------------------------------------------------
> >-------------------------------
> >
> ><!-- My own build.proxies.xml file -->
> ><project ...
> >...
> >
> ><!-- Override the target to add the dependency of build -->
> ><target depends="generateproxies" name="build" />
> >
> ><target name="generateproxies">
> >    <!-- generate the proxies for the project -->
> ></target>
> >
> ><!-- End of my own build.proxies.xml file -->
> >
> >
> >
> >Or, do you have any other suggestion in order no to modify the main
> >build.xml file every time?
>
>
> You can overwrite targets and its dependencies.
> You can access the overwritten targets by "full qualified names"
> ${AntProjectName.TargetName}.
> In your case your "build" eliminates the dependency on
> "build-subprojects,build-project".
>
> <!-- Eclipse automatically generated build.xml file -->
> <project name="foo" ...
>     <target depends="build-subprojects,build-project" name="build"/>
>    ...
> <!-- End of Eclipse automatically generated build.xml file -->
> <!-- My own build.proxies.xml file -->
> <project name="myfoo" ...
>     <!-- Override the target to add the dependency of build -->
>     <target depends="generateproxies,foo.build" name="build" />
>    ....
> <!-- End of my own build.proxies.xml file -->
>
>
>
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>