Was this the right place to ask this ?

- Pascal

-----Original Message-----
From: Pascal Lalonde [mailto:[EMAIL PROTECTED]
Sent: October 31, 2008 9:45 AM
To: user@ant.apache.org
Subject: ANT_OPTS programatically

Hi,

    Before, I was using the ANT_OPTS environment variable to give more memory 
to ant for the build to be done.

Now, I am calling ant programmatically this way:

File buildFile = new File("build.xml");
Project p = new Project();

DefaultLogger consoleLogger = new DefaultLogger();
consoleLogger.setErrorPrintStream(System.err);
consoleLogger.setOutputPrintStream(System.out);
consoleLogger.setMessageOutputLevel(Project.MSG_VERBOSE);

p.addBuildListener(consoleLogger);

p.setUserProperty("ant.file", buildFile.getAbsolutePath());

p.setProperty("repos.url", model.getReposUrl());
p.setProperty("repos.username", model.getReposUsername());
p.setProperty("repos.password", model.getReposPassword());
p.setProperty("repos.revision", model.getReposRevision());

p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();

p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.executeTarget(task);

I am still setting this variable, but looks like it's now not considered and 
the build fails with an Java Heap Space exception. But if I run the build 
directly with ant in the console, the build passes,

I tried giving more memory to my java application using the -Xmx argument, but 
doesn't change anything.
Any advice ?
Pascal Lalonde
Technicien de service / Développeur logiciel / Test
[EMAIL PROTECTED]<mailto:>
COMACT
Équipements Comact Inc.
3675 boul. de la Grande-Allée, Boisbriand (Québec) J7H 1H5
Tél: 450 435 2121 x 296
Fax: 450 430 3407


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to