ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Use of XML Catalog with Ant (xslt task) - request for example
Date Sat, 31 Aug 2013 05:59:29 GMT
On 2013-08-30, Kerry, Richard wrote:

> I'm still unclear about this.  Internally within Ant there seems to be
> a Classpath that is some combination of CLASSPATH environment
> variable, -cp parameter, <classpath>, <path id="classpath" >, <path
> id="class.path" >. <xslt ><classpath /></xslt>.

> Which one can/should I put my resolver's location in ?

<path id="..."/> just defines a PATH like structure.  Whether it
contributes to loading a class or not completely depends on where it is
used - if at all - via refid.  <path id> defines a global variable but
its id doesn't have any special meaning to Ant.

Whether you put classes into $CLASSPATH or -cp into -lib or $ANT_HOME/lib
or into nested <classpath> elements influences which classloaders they
end up in and what you can do with them.  Say jar A needs jar B and you
place jar A in $CLASSPATH then it will not find B if it isn't part of
$CLASSPATH as well even if you use -lib as $CLASSPATH populates the
system classloader and -lib a child of the system classloader that is
invisible to classes loaded via the system classloader.

Some general hints:

* don't use -cp at all.  Use the wrapper script shipping with Ant and
  one of the other options.

* don't try to mix where you place your jars that depend on each other.
  In the case of ant-resolver.jar and xml-resolver.jar I'd recommend to
  put them both into $ANT_HOME/lib or use -lib (this is equivalent) but
  never split them.  The alternative is to not put them into
  ANT_HOME/lib but use a nested <classpath> holding both of them
  instead.

* if you find yourself having to specify -lib all the time, use
  $ANT_HOME/lib

Stefan

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


Mime
View raw message