Hi,
        By the same notion, is there a way to get the current target's name?

Thank You,
 
Edward Grinvald
Computer Associates International
Programmer, Storage Development
[EMAIL PROTECTED]
1-631-342-6000 x76350


-----Original Message-----
From: Diane Holt [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, June 11, 2002 1:32 PM
To: Ant Users List
Subject: Re: access to task description?


--- "Hertel, Oliver" <[EMAIL PROTECTED]> wrote:
> is there a way to access the target description [...]?

You can either add the following to every target you want to have the description 
printed out for:
    <script language="javascript"><![CDATA[
      desc = self.getOwningTarget().getDescription();
      if( desc != null ) {
        java.lang.System.out.println(desc);
      }
    ]]></script>

Or compile, jar, and taskdef the following:
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.Task;

  public class PrintDesc extends Task {

      // The method executing the task
      // @param None Executes the task
      public void execute() throws BuildException {
          String desc = getOwningTarget().getDescription();
          if( desc != null ) {
              System.out.println(desc);
          }
      }
  }

and include a <printdesc/> in any target you want the description printed out for.

(Maybe there's some more clever way, but it's the best I can come up with while 
waiting for my coffee to brew :)

Diane

=====
([EMAIL PROTECTED])



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to