ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ylan Segal" <>
Subject RE: Echoing message
Date Thu, 11 Oct 2001 23:33:12 GMT
You can check for the presence of properties and make a target that displays
help for the user if not all properties are set. Enclosed is part of my
build file where I use this behavior:

<target name="check" description="Checks weather project is ready for
	<echo message="Build started: ${DSTAMP}"/>
	<property name="check.src.home" value="$${src.home}"/>
	<property name="" value="$${}"/>
	<property name="check.dist.home" value="$${dist.home}"/>
	<property name="check.javadoc.home" value="$${javadoc.home"/>
	<property name="check.doccheck.home" value="$${doccheck.home}"/>
	<property name="check.packages" value="$${packages}"/>
	<property name="check.lib.home" value="$${lib.home}"/>
	<property name="check.extlibs.home" value="$${extlibs.home}"/>
	<condition property="">
			<equals arg1="${check.src.home}" arg2="${src.home}"/>
			<equals arg1="${}" arg2="${}"/>
			<equals arg1="${check.dist.home}" arg2="${dist.home}"/>
			<equals arg1="${check.javadoc.home}" arg2="${javadoc.home}"/>
			<equals arg1="${check.doccheck.home}" arg2="${docheck.home}"/>
			<equals arg1="${check.packages}" arg2="${packages}"/>
			<equals arg1="${check.lib.home}" arg2="${lib.home}"/>
			<equals arg1="${check.extlibs.home}" arg2="${extlibs.home}"/>

	<antcall target="help"/>

<!-- Gives intructions on how to proceed if check is not succesful -->
<target name="help" if="">
	Not all needed properties are set!!!
	This build file needs a build.properies file to set the following
		src.home - The source code (.java files) home. - Where the classes are compiled to.
		dist.home - The directory where distribution files are created.
		javadoc.home - The directory for the javadoc html.
		doccheck.home - The directory for the DocCheck html
		packages - the packages to compile, it accepts * (ie tv.*)
		lib.home - Directory where needed jar's are stored.
		extlibs.hom - Directory where needed jar's are copied from.

	Other properties can also be set in this file (like build.compiler, etc).
	<fail message="Not all needed properties are set!!!"/>
Then I make all other targets depend on check.. the build will not work
unless all properties are set as I want them to..
In your case, you are checking for classnames, but I think you can make it
work in the same way.

> -----Original Message-----
> From: ALI,HANEEF (HP-Cupertino,ex1) []
> Sent: Thursday, October 11, 2001 5:21 PM
> To:
> Subject: Echoing message
> Hi,
> I want to warn the user that some thing is missing.How to do it easily.?
> Eg:
>  <available property="junit.present"
> classname=""
>              classpathref="classpath" />
> if the property junit.present is not set I want to warn the user that
> junit.jar is not
> in classpath.
> We can do this by having a separate target, but there are many
> such warning
> message and
> i don't want to create a target for each and every message
> Thanks
> Haneef

View raw message