ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Defining Properties in an Antlib
Date Fri, 06 Nov 2009 09:45:54 GMT
I only see an init macro which sets the values.


<project xmlns:my="antlib:my">
  <taskdef uri="antlib:my" resource="antlib.xml" classpath="."/>
  <echoproperties prefix="my."/>

<antlib xmlns:current="ant:current">
  <macrodef name="init">
          <property name="my.--flag--" value="set"/>
          <property name="my.text" value="Hello World"/>
  <presetdef name="checkinit">
      <fail unless="my.--flag--" message="You have to call the 'init' task before using
any other."/>
  <macrodef name="hello">
          <echo message="Hello" taskname="hello"/>

>-----Urspr√ľngliche Nachricht-----
>Von: Dan Turkenkopf [] 
>Gesendet: Donnerstag, 5. November 2009 19:28
>Betreff: Defining Properties in an Antlib
>Is there anyway to define a single set of properties that can be shared
>across all macrodefs in a given antlib?
>I have a series of macros that all refer to the same jar 
>files.   I'd like
>to be able to define the locations in a single property within 
>the antlib
>(because the callers don't need to know the details).
>Right now, because Property doesn't extend AntlibDefinition, I 
>can't declare
>a property outside of a macrodef.  So I'm stuck declaring the 
>same property
>within each of the macrodefs.
>Is there a better way to accomplish the goal of DRY?
>Dan Turkenkopf

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message