|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Defining Properties in an AntlibIs 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? Thanks, Dan Turkenkopf |
|
|
AW: Defining Properties in an AntlibI only see an init macro which sets the values.
Jan <project xmlns:my="antlib:my"> <taskdef uri="antlib:my" resource="antlib.xml" classpath="."/> <my:init/> <my:hello/> <echoproperties prefix="my."/> </project> <antlib xmlns:current="ant:current"> <macrodef name="init"> <sequential> <property name="my.--flag--" value="set"/> <property name="my.text" value="Hello World"/> </sequential> </macrodef> <presetdef name="checkinit"> <fail unless="my.--flag--" message="You have to call the 'init' task before using any other."/> </presetdef> <macrodef name="hello"> <sequential> <current:checkinit/> <echo message="Hello" taskname="hello"/> </sequential> </macrodef> </antlib> >-----Ursprüngliche Nachricht----- >Von: Dan Turkenkopf [mailto:dturkenk@...] >Gesendet: Donnerstag, 5. November 2009 19:28 >An: user@... >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? > >Thanks, > >Dan Turkenkopf > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |