ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Detlef Brendle" <detlef.bren...@canoo.com>
Subject Ant child project.
Date Thu, 11 Jul 2002 07:01:33 GMT
Hi all ,
I got stuck with an ant-project.
I want to generate a child Ant-Project from within my Task. I do it like
this(just a dummy):

*****************start java Task****************
package com.csg.pb.frontnet.dev_arch.ant_util;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildLogger;
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.ProjectHelper;

import java.io.File;

public class DummyTask extends Task {


    public void execute() throws BuildException {
        Project child = new Project();
        child.init();
        child.setBaseDir(project.getBaseDir());
        attachDefaultLogger(child);
        File buildfile = new File("c:/temp/build.xml");
        ProjectHelper.configureProject(child,buildfile);
        child.executeTarget(child.getDefaultTarget());
    }

     private void attachDefaultLogger(Project child) {
        BuildLogger blo = new DefaultLogger();
        blo.setMessageOutputLevel(Project.MSG_INFO);
        blo.setOutputPrintStream(System.out);
        blo.setErrorPrintStream(System.err);
        child.addBuildListener(blo);
    }
}
********************end java task****************
the child project file looks like:
*********************start child project xml**********
<?xml version="1.0" ?>

<project name="DUMMY" default="all" >


<target name="all" depends="init" >
	<echo>output von all.</echo>
	<antcall target="dummy" />
</target>

<target name="init" >
	<echo>output von init.</echo>
</target>

<target name="dummy" >
	<echo>output von dummy.</echo>
</target>

</project>
*********************end child project xml**********

The task in my parent project (the project where this class maps to a task)
calls execute but in the child I get the following error message:

dummy:
[dummyTask] init:
[dummyTask]      [echo] output von init.
[dummyTask] all:
[dummyTask]      [echo] output von all.

BUILD FAILED

c:\temp\build.xml:8: Target `dummy' does not exist in this project.
*******************************************

Do I miss some init in my task ? It can find dependencies but it cannot
resolve the <antcall>

Any help would be appreciated.

thanks,

detlef

-----Original Message-----
From: Peter Donald [mailto:peter@apache.org]
Sent: Thursday, July 11, 2002 1:46 AM
To: Ant Developers List
Subject: Re: [ANNOUNCEMENT] Ant 1.5 Released


Three cheers for Magesh!!!

Thanks for all that work it is much appreciated!

At 10:58 AM 7/10/2002 -0400, you wrote:
>This is to announce that Jakarta Ant-Dev has released
>Version 1.5 of Apache Ant, a Java-based build tool.
>
>The release is available in binary and source forms
>at http://jakarta.apache.org/builds/jakarta-ant/release/v1.5/
>The changes between the last release and this one
>are also highlighted there.
>
>If you notice any problems with this release, please notify
>Ant-Dev by filing a bug report at
>http://nagoya.apache.org/bugzilla/enter_bug.cgi?product=Ant
>
>Cheers,
>Magesh
>
>********************************
>* So what's the speed of dark? *
>********************************
>
>
>--
>To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message