Hi User List,

I try to start an Ant Buildfile from Java.
Unfortunately Ant is not able to load custom ant tasks, although I try to set the classloader for the thread.

Here is the code snip I use.

    public static void startForNode(final AntRunnerNode ar,boolean wait) {
        Thread t=new Thread() {
            public void run() {
                try {
                    Project project=new Project();
                    project.init();
                    project.setSystemProperties();

ProjectHelper.configureProject(project, ar.getBuildFile());

                    project.executeTarget(ar.getTargetName());
                } catch (Exception e) {
                    e.printStackTrace();
                }

            }
        };
t.setContextClassLoader(Thread.currentThread().getContextClassLoader());
        if (wait) {
            t.run();
        } else {
            t.start();
        }
    }


Any help appreciated.
Thanks,
Stefan.


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

Reply via email to