In an ant file how do you check if a property exists?

1 answer

Answer

1204981

2026-02-19 07:35

+ Follow

Previous answer worked, but logic was backwards. Here is a version I've tested:

<if>

<equals arg1="${env.MYVAR}" arg2="$${env.MYVAR}" />

<then>

<echo>MYVAR param did not exist</echo>

</then>

<else>

<echo>MYVAR param existed - ${env.MYVAR}</echo>

</else>

</if>

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.