Wiki source code of Ant
Last modified by Sebastian Marsching on 2022/05/27 22:17
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{toc/}} | ||
| 2 | |||
| 3 | # Classpath trouble with ant | ||
| 4 | |||
| 5 | Problem | ||
| 6 | : If you have a `<taskdef>` in your `build.xml`, ant will evaluate the specified `classpath` when processing the `<taskdef>`. However, if you are using a `loaderRef`, ant will only evaluate the `classpath` at the first time a `<taskdef>` with the specified `loaderRef` is instantiated and reuse this classloader later. This can cause problems when the classpath reference changes later (e.g. because JAR files are placed in a directory that is used in the `FileSet` used to define the classpath reference). | ||
| 7 | |||
| 8 | Solution | ||
| 9 | : Define tasks as late as possible and only use a common classloader if you have to share objects between tasks. |