ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey N. Solofnenko" <A.Solofne...@mdl.com>
Subject Re: How can I execute Ant targets from within a Java program?
Date Mon, 24 Jan 2005 01:52:22 GMT
You need to set ant.home Java property, not the environment variable, if 
you want to launch ANT yourself.

- Alexey.

Andy Kriger wrote:

>I am playing around with executing Ant targets from Java code.
>
>Here's what I am trying to do (based on what I've seen in mailing list posts)...
>
>       public static void main(String[] args) {
>		ProjectHelper ph = ProjectHelper.getProjectHelper();
>		Project p = new Project();		
>		ph.parse(p, new java.io.File("build.xml"));
>		System.out.println(p.getBaseDir());
>		System.out.println(p.getDefaultTarget());
>	}
>
>But I get ...
>Exception in thread "main" build.xml:6: Could not create task or type
>of type: description.
>
>The $ANT_HOME env var is set and I have all of the $ANT_HOME/lib dirs
>on my classpath. So, either that's not the way to create an in-memory
>version of a build script that can be called from code or there's
>something more I need to do with my classpath so that the
>ProjectHelper can find all the JARs.
>
>Can anyone point me in the right direction?
>
>thx
>andy
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>  
>

-- 
------------------------------------------------------------------------
/ Alexey N. Solofnenko
home: http://trelony.cjb.net/
/

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


Mime
View raw message