Hello,
it just occurred to me that ant build scripts are XML
files (I am a genius, aren't I :) ), so you can use
<xmlproperty>[1] to extract the name attribute of
project node:
<project name="main" default="main" basedir=".">
<target name="main">
<echo>Main project name is
${ant.project.name}</echo>
<subant antfile="sub.xml" target="sub"
buildpath="${basedir}"/>
<xmlproperty file="sub.xml"
semanticAttributes="true" keepRoot="yes"/>
<echo>${project.name}</echo>
</target>
</project>
So it is possible, but clumsy - for example you have
to iterate over the fileset using <for>[2]. By the
way, in 90% of the cases projects' names are just for
user convenience and are not so important for the
build process. The other 10% where they are important
for the build process itself concerns <import>[3]
task. So why do you need them?
Regards
Ivan
[1]http://ant.apache.org/manual/CoreTasks/xmlproperty.html
[2]http://ant-contrib.sourceforge.net/tasks/tasks/for.html
[3]http://ant.apache.org/manual/CoreTasks/import.html
--- [EMAIL PROTECTED] wrote:
> thanks ivan.
> I was aware of the ${ant.project.name}property, but
> indeed i want the names of all sub projects in my
> main ant files that iterates through these projects.
>
>
> -----Original Message-----
> From: Ivan Ivanov
> [mailto:[EMAIL PROTECTED]
> Sent: Thu 7/14/2005 5:34 PM
> To: Ant Users List
> Subject: Re: retrieving project names with subant
>
> Hello,
>
> --- [EMAIL PROTECTED] wrote:
> >
> > hello gentle people;
> > is there a way to retrieve the names of the
> project
> > being run when using subant?
>
> The name of the currenr project is stored in the
> built-in property ant.project.name. So you can use
> something like this:
> <project name="main" default="main" basedir=".">
> <target name="main">
> <echo>Main project name is
> ${ant.project.name}</echo>
> <subant antfile="sub.xml" target="sub"
> buildpath="${basedir}"/>
> </target>
> </project>
>
> <project name="sub" default="sub">
> <target name="sub">
> <echo>Sub project name is
> ${ant.project.name}</echo>
> </target>
> </project>
>
> But if you want in your main file the names of all
> sub
> projects, it would be harder.
>
> Regards
> Ivan
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
>
>
> This message is for the designated recipient only
> and may contain privileged, proprietary, or
> otherwise private information. If you have received
> it in error, please notify the sender immediately
> and delete the original. Any other use of the email
> by you is prohibited.
>
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]