In attempting to use custom Ant tasks with Jaxb in then I was unable get the correct class loader in the task as method: (Call stack at the end) public AntClassLoader(Project project, Path classpath, boolean parentFirst) { this(null,project, classpath, parentFirst); } does not pass the classloader on to the next constructor. I changed the call to the following and rebuilt and this fixed my problem: public AntClassLoader(Project project, Path classpath, boolean parentFirst) { this(project.getCoreLoader(), project, classpath, parentFirst); } Call Stack: AntClassLoader.<init>(Project, Path, boolean) line: 340 Taskdef(Definer).createLoader() line: 275 Taskdef(Definer).execute() line: 151 Taskdef(Task).perform() line: 341 Target.execute() line: 309 Target.performTasks() line: 336 Project.executeTarget(String) line: 1339 Project.executeTargets(Vector) line: 1255 Maybe I am not using ant the way it was designed to be used? Hope this is helpful, ant is the greatest!
If you pass null, AntClassLoader uses its own ClassLoader as the parent loader. This should be the same as project.getCoreLoader(). Can you let me know what problem you are having as I'm not sure why the ClassLoader change you suggest would change anything.
If you have called project.setCoreLoader(coreLoader) where coreLoader is not null but a specific loader you wish to be the parent loader then this loader however will get discarded in the call outlined below. this(null,project, classpath, parentFirst); We are using Ant like a workflow engine inside an app-server and so we need certain things that we have from the appservers classloader available in ant so I need to pass appservers classloader into ant I am doing this by setting it in the project. Hope this helps a bit? Tim
See also bug #30161 which could be seen as a by-product of this.
One needs to do a small number of other things as well. I have opened a new bug specifically for coreloader and will make this a duplicate of that. *** This bug has been marked as a duplicate of 40522 ***