ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier De Wolf <o...@skynet.be>
Subject Problem running ant "by hand". project.configureProject() problem
Date Sun, 27 Oct 2002 15:21:06 GMT
Hi,


I'm making a Servlet that call ant targets. I thinks that'a a good idea 
because I can throw away a lot of compiled code. For perfomance 
reasons, I would like to create A Project object only at init time and 
then execute Target on request.

I did the following :

		Project project = new Project();
		project.setCoreLoader(null);
		ProjectHelper.configureProject(project, new File("buildServlet.xml"));
		System.out.println("Project : "+project.getName());
		System.out.println("defaultTarget : "+project.getDefaultTarget());
		Target target= (Target) project.getTargets().get("usage");
		Task task = target.getTasks()[0];
		System.out.println("task : "+task.getClass());
		//project.executeTarget("usage");

Where buildServlet.xml is :

<project name="compile" default="usage" basedir=".">
	<target name="usage">
		<echo message="Hello, world"/>
	</target>
</project>


I receive the following log :

      [java] Project : compile
      [java] defaultTarget : usage
      [java] task : class org.apache.tools.ant.UnknownElement


Is It normal that the <echo> task is UnknownElement. I suppose it's not 
because if I uncomment the last line (executeTarget) :

Exception in thread "main" buildServlet.xml:3: Could not create task or 
type of type: echo.
+the usual advice on classpath.


Note : I have all ant lib in my classpath.

I checked the source code of org...ant.Main (that works), but I could 
not find my mistake.



Thank for your help.





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