On 2012-09-26, Jose Rojas wrote: > I would like to create a custom ant task that caches some results from an > operation and saves it for use in future executions. My simple method of > doing this is using a 'static' member. This would work great for me as the > operations would be appropriate to cache at an application wide level.
A better approach might be to store the data as a reference in the Project instance (or several of them). > However what I'm noticing is that for each new execution of Ant (I'm using > the Ant taskdef to execute ant), the static data is lost, quite possibly > caused by Ant creating a new class loader upon every execution, thus not > reusing my ant task class instance from the previous execution. This would happen if you use multiple taskdefs - i.e. repeat it several times. You can pass a name of a class loader to taskdef (the loaderRef attribute) and Ant will create a class loader on the first execution, cache it and reuse it for all subsequent task/typedefs that use the same name. Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org