ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pascal Lalonde <plalo...@comact.com>
Subject ANT_OPTS programatically
Date Fri, 31 Oct 2008 13:45:22 GMT
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
plalonde@comact.com<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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message