void (final Class<?> helperClass) { // for ant 1.7, there is a dedicated method for cache clearing try { helperClass.getDeclaredMethod("clearCache").invoke(null); } catch (Throwable e) { try { // assume it is older version of ant Map helpersCollection = ReflectionUtil.getField(helperClass, null, null, "helpers"); if (helpersCollection != null) { helpersCollection.clear(); } } catch (Throwable _e) { // ignore. } } }