ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Weiqi Gao <weiqi...@networkusa.net>
Subject Re: accessing Ant project name
Date Mon, 27 Nov 2000 02:21:47 GMT
"R. Mark Volkmann" wrote:
> 
> Is it possible to reference the name of a project within a target?
> For example, can I do something like this?
> 
> <project name="My Project">
>   <target name="getProjectName">
>     <echo message="${project.name}"/>
>   </target>
> </project>
> 
> I made up the property name "project.name". This doesn't work but it seems
> there should be some way I can use the name of the project within a target.

Not right now.  But we can easily add such a property with the following
patch, which makes the ${project.name} property behave like the
${basedir} property:

Index: Project.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.45
diff -c -r1.45 Project.java
*** Project.java	2000/11/25 02:38:34	1.45
--- Project.java	2000/11/27 00:55:32
***************
*** 286,291 ****
--- 286,292 ----
  
      public void setName(String name) {
          this.name = name;
+         setProperty("project.name", name);
      }
  
      public String getName() {
Mime
View raw message