Alternatively, you could define a target failIfMissingRequiredProperties
like
<target name="failIfMissingRequiredProperties" unless="all.okay">
<fail message="Set required properties"/>
</target>
<target name="init">
<condition property="all.okay">
// use NOT, AND, OR etc here to check all required properties
</condition>
<antcall target="failIfMissingRequiredProperties"/>
</target>
and make all your targets in the project depend on the init target.
You would need ant 1.4 for this.
Azariah
> -----Original Message-----
> From: Jason Rogers [mailto:jason.rogers@tumbleweed.com]
> Sent: Wednesday, September 19, 2001 12:17 PM
> To: 'ant-user@jakarta.apache.org'
> Subject: RE: Checking if properties is set
>
>
> <target name="preinit" if="property.one, property.two, property.three,
> property.four">
> <property name="all.okay" value="yes"/>
> </target>
> All of the other targets have <...if="all.okay"...> set.
> -Jason
>
> > -----Original Message-----
> > From: Ylan Segal [mailto:ylan@digiworks.tv]
> > Sent: Wednesday, September 19, 2001 4:04 PM
> > To: ant-user@jakarta.apache.org
> > Subject: Checking if properties is set
> >
> >
> > Hi,
> >
> >
> > I am trying to write a target that checks if all needed
> > properties are set
> > before it actually does anything else.
> > Why? because there are several developers working on a
> > project and since the
> > build.xml is being checked into cvs, the specific
> > properties (like src.home,
> > javadoc.home, etc) are particular to each developer and set in a
> > build.properties that is NOT checked-in to cvs.
> > However, I have managed to check with the condition task if the
> > build.properties is present, but that does not garantee
> > that all the
> > properties needed are set, for example, if javadoc.home
> > is not set, then I
> > end up having a directory created with the name ${javadoc.home}.
> > I want the build to fail if not all required properties are set.
> >
> > Does anyone have an idea on how to do this? What I want
> > really, is for the
> > condition task to be able to check for a specific property.
> >
> > All help greatly appreciated.
> >
> > Ylan Segal.
> >
> >
> >
>
>
|