You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "KARR, DAVID" <dk...@att.com> on 2014/05/30 01:11:52 UTC

How to gracefully not use a feature if the task jar isn't present?

I'm trying to implement an optional feature in a build script that utilizes the "xmltask" jar. To be less intrusive, I want the feature to be silently disabled if the xmltask jar isn't available.  I initially assumed that I would check for the presence of the jar in "$HOME/.ant/lib", but that has a few problems.  I can get this to work, but I realized that "$HOME" doesn't work for Windows, and "$USERPROFILE" doesn't work for non-windows.  In addition, someone could conceivably install the jar in $ANT_HOME/lib or somewhere else.

I'm already using "if:set" on a property that I set if the jar is available, but I'd like that check to be a little more robust.  I don't see a good way to do that.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: How to gracefully not use a feature if the task jar isn't present?

Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: KARR, DAVID
> Sent: Thursday, May 29, 2014 4:12 PM
> To: Ant Users List
> Subject: How to gracefully not use a feature if the task jar isn't
> present?
> 
> I'm trying to implement an optional feature in a build script that
> utilizes the "xmltask" jar. To be less intrusive, I want the feature to be
> silently disabled if the xmltask jar isn't available.  I initially assumed
> that I would check for the presence of the jar in "$HOME/.ant/lib", but
> that has a few problems.  I can get this to work, but I realized that
> "$HOME" doesn't work for Windows, and "$USERPROFILE" doesn't work for non-
> windows.  In addition, someone could conceivably install the jar in
> $ANT_HOME/lib or somewhere else.
> 
> I'm already using "if:set" on a property that I set if the jar is
> available, but I'd like that check to be a little more robust.  I don't
> see a good way to do that.

Never mind, I noticed the "classname" property of the "available" task.  I sort of wish there was a "package" property instead, but this will work.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org