ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Balasubramanian, Ravi Shankar" <rbala...@informatica.com>
Subject Problems with calling an ant java task programatically
Date Fri, 13 Apr 2007 07:21:43 GMT
Hi ,

I am using ant 1.6.5 and 

My ant script is as follows:

 

"

<target name="start-repository" description="Start the test repository"
depends="">

        <path id="repagent.classpath">

            <fileset
dir="${infa.home}/applications/rep_agent/bootstrap/lib">

                <include name="*.jar" />

            </fileset>

        </path>

                    <java
classname="com.informatica.repository.common.bootstrap.LaunchApp"
fork="true" spawn="true">

          <jvmarg value="-ea"/>

          <!--jvmarg value="-Xdebug"/>

          <jvmarg
value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8602"/--
>

          <jvmarg value="-Dinfa.home=${infa.home}"/>

          <jvmarg value="-Dapplication.name=rep_agent"/>

          <classpath refid="repagent.classpath"/>

  </java>

  </target>

"

 

I am trying to call this target programmatically from a java application
as follows:

{

File antFile = new File(REPAGENT_ANT_SCRIPT);

Project p = new Project();

DefaultLogger consoleLogger = new DefaultLogger();

consoleLogger.setErrorPrintStream(System.err);

consoleLogger.setOutputPrintStream(System.out);

consoleLogger.setMessageOutputLevel(Project.MSG_INFO);

p.addBuildListener(consoleLogger);

p.fireBuildStarted();

p.init();

ProjectHelper helper = ProjectHelper.getProjectHelper();

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

helper.parse(p, new File(p.getUserProperty("ant.file")));

p.executeTarget("start-repository");

p.fireBuildFinished(new BuildException("BUILD FINISHED"));

}

 

When I run this java application, the code waits for the process that
was started by the ant target to end before exiting this method. I do
not want this to happen and I want to continue with the java application
after executing the ant target. 

 

Can someone let me know how I can accomplish this? 

Regards,

Ravi.

"Tough times never last, but tough men do..."

 


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