You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Cole, Derek E" <de...@lmco.com> on 2009/05/07 20:27:42 UTC

Configure an ANT project in Java

Hello all. I am trying to configure an Ant project from a Java class
using the API. I have set up my Project like so

 

antproject.init();

                  ProjectHelper helper =
ProjectHelper.getProjectHelper();

                  antproject.addReference("ant.projectHelper", helper);

                  helper.parse(antproject, buildFile);

 
antproject.executeTarget(antproject.getDefaultTarget());

 

The problem is, I don't think all of the properties are loading
properly. Some of my build files that use a property file seem to not be
getting the values from the build.properties file they are using. I also
seem to be losing the value of JAVA_HOME in the build files. I am not
sure why this is happening. Whenever I get to a javac task, the build
fails.

 

I have not tried to set the property "java.home" because I didn't think
I had to.  I basically want to do as minimal configuring of the project
as possible, as if I was just running ant from the command line, because
all of my buildfiles are already complete..just trying to automate the
execution of previously existing files.

 

Thanks in advance,

 

Derek