I checked out the link.  Anthill is just "spawning" a process to run the Ant
Executable for the specified platform.  So they are not programmatically
using ant as I want to do.  I want my solution to be a Java solution.

Anyone else have any other ideas?

Thank you,

Marc


On 8/16/06, Marc Farrow <[EMAIL PROTECTED]> wrote:

Thanks for the tip Tom.  I will definitely check it out.


On 8/16/06, Tom Cunningham <[EMAIL PROTECTED]> wrote:
>
>
> Have you taken a look at Anthill 
(http://www.urbancode.com/projects/anthill/default.jsp
> )?   There's an open source version which you can hack up, but it seems
> like it does the same thing that you are trying to do here (kick off ant
> from the web).     If you do need to do this, you might want to check the
> code in their open source version for how they handle their classloaders.
>
> On Wednesday, August 16, 2006, at 08:27AM, Marc Farrow <
> [EMAIL PROTECTED]> wrote:
>
> >I have some servlet and I am trying to call an Ant script within the
> class
> >to compile a "project".  All of the references in the build script are
> not
> >relative, therefore some of the classpath references are not
> correct.  I
> >know I can change the properties, etc to fix this.  However, due to the
>
> >nature of our environment we do not want to do this.  With all that
> being
> >said, I do know that all the classpath entries that I need to compile
> the
> >needed classes are within my current servlet container (in my case
> Tomcat).
> >What can I do retrieve the correct classloader so that all the classes
> are
> >visible to the Ant script.  Below is a snippet of code I am using.  In
> >comments, you will see the various ways I have tried to call the
> >setCoreLoader method.
> >
> >Thank you,
> >
> >File buildfile = null;
> >try {
> >     buildfile = new File(this.workingDirectory.getPath() +
> "/build.xml");
> >     Project project = new Project();
> >     project.setBaseDir(this.workingDirectory);
> >     project.setName(this.project);
> >     project.setUserProperty("ant.file", buildfile.getPath());
> >     project.init();
> >     ProjectHelper helper = ProjectHelper.getProjectHelper();
> >     project.addReference("ant.projectHelper", helper);
> >     helper.parse(project, buildfile);
> >     Properties sysProps = System.getProperties();
> >     for (Iterator it = sysProps.entrySet().iterator();it.hasNext();) {
> >  Map.Entry entry = (Map.Entry) it.next();
> >  project.setProperty(entry.getKey().toString(), entry.getValue
> >().toString());
> >     }
> >     project.setProperty ("basedir", project.getBaseDir().getPath());
> >     project.setProperty("ant.project.name", project.getName());
> >     project.setProperty("ant.file ", buildfile.getPath());
> >     project.setCoreLoader(Thread.currentThread
> ().getContextClassLoader());
> >//     project.setCoreLoader(null);
> >//     project.setCoreLoader(this.getClass().getClassLoader());
> >//     project.setCoreLoader(Thread.currentThread
> >().getContextClassLoader().getParent());
> >     project.execute("dist");
> >} catch (Exception e) {
> >     throw new RuntimeException(e);
> >} finally {
> >     project = null;
> >     buildfile = null;
> >}
> >
> >
> >--
> >Marc Farrow
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--

Marc Farrow




--
Marc Farrow

Reply via email to