Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 98242 invoked from network); 3 Nov 2009 00:44:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Nov 2009 00:44:43 -0000 Received: (qmail 56199 invoked by uid 500); 3 Nov 2009 00:44:42 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 56113 invoked by uid 500); 3 Nov 2009 00:44:42 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 56103 invoked by uid 99); 3 Nov 2009 00:44:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Nov 2009 00:44:41 +0000 X-ASF-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sjselvan@gmail.com designates 209.85.160.41 as permitted sender) Received: from [209.85.160.41] (HELO mail-pw0-f41.google.com) (209.85.160.41) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Nov 2009 00:44:39 +0000 Received: by pwj11 with SMTP id 11so2440317pwj.20 for ; Mon, 02 Nov 2009 16:44:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=yDGulDh4FxvKEbWQ5gQyE5PiMudhxKyMgqEnCEX9NF8=; b=EIMvaBCKnujJAQm3+i1xnK/WFdBRaVz5Pq/moTh8btCBmKJ5dSuORs5KEyk7JjN4/8 h5m9XUD3PAP3MzaUm8zTLEJco+9/KogJ3oQTps2nltGDirk+jdgRpC//WDLwlLrsQoWF qSefm+Z1aggjCA6Rp2oqHWzgCE0b53Xd9PcsY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Psn/7C56ZiFP7ILQs3n8GG8jeEkht/NESodStiyeiBgEJ8ndqG50I9Qs9B0wSj+dqy 6IvKiDsRjezxJml8TUhag9tCicgEIIfAi+HJYTA5MLXCgQhDm/+8lNbz6/dLl4Y7i/8y oq+J78RVL+b2Qtx4JCNIzYdBFJQetxj4poKeI= MIME-Version: 1.0 Received: by 10.114.7.32 with SMTP id 32mr9912981wag.107.1257209058921; Mon, 02 Nov 2009 16:44:18 -0800 (PST) In-Reply-To: References: Date: Mon, 2 Nov 2009 16:44:18 -0800 Message-ID: <53b74b910911021644s3dffb6eaic70edf72271b672e@mail.gmail.com> Subject: Re: Ant build script executing task using java code From: Jay To: Ant Users List Cc: mgainty@hotmail.com Content-Type: multipart/alternative; boundary=0016e648d66e5d8e1e04776ccb35 --0016e648d66e5d8e1e04776ccb35 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Martin, I'm using the execute method from the class org.apache.tools.ant.Project. Thanks Jay On Mon, Nov 2, 2009 at 4:34 PM, Martin Gainty wrote: > > any way to take a look at the code for executeTarget > project.executeTarget(taskName);? > Martin Gainty > ______________________________________________ > Verzicht und Vertraulichkeitanmerkung/Note de d=E9ni et de confidentialit= =E9 > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugt= e > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht > dient lediglich dem Austausch von Informationen und entfaltet keine > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > Ce message est confidentiel et peut =EAtre privil=E9gi=E9. Si vous n'=EAt= es pas le > destinataire pr=E9vu, nous te demandons avec bont=E9 que pour satisfaire > informez l'exp=E9diteur. N'importe quelle diffusion non autoris=E9e ou la= copie > de ceci est interdite. Ce message sert =E0 l'information seulement et n'a= ura > pas n'importe quel effet l=E9galement obligatoire. =C9tant donn=E9 que le= s email > peuvent facilement =EAtre sujets =E0 la manipulation, nous ne pouvons acc= epter > aucune responsabilit=E9 pour le contenu fourni. > > > > > > To: user@ant.apache.org > > From: sjselvan@gmail.com > > Subject: Ant build script executing task using java code > > Date: Tue, 3 Nov 2009 00:11:56 +0000 > > > > Hi, > > > > When I tried to execute a sql task during server start up using a java > code, it > > completely freezes the app server disabling the users making any furthe= r > > request. > > > > Here is the sample code i have (this is a standalone java code in which > nothing > > gets printed after the call to execute the specified task in ant). > > > > > > > > import org.apache.tools.ant.*; > > > > import java.io.*; > > import java.util.*; > > > > > > public class AntRunnerTest > > { > > > > private Project project; > > > > public void executeTask(String taskName){ > > try{ > > project =3D new Project(); > > > > > > DefaultLogger consoleLogger =3D new > > DefaultLogger(); > > > consoleLogger.setErrorPrintStream(System.err); > > > consoleLogger.setOutputPrintStream(System.out); > > > > consoleLogger.setMessageOutputLevel(Project.MSG_INFO); > > project.addBuildListener(consoleLogger); > > > > project.fireBuildStarted(); > > project.init(); > > project.setBasedir(new String(".")); > > ProjectHelper helper =3D > > ProjectHelper.getProjectHelper(); > > project.addReference("ant.projectHelper"= , > > helper); > > helper.parse(project, new File("build- > > copy.xml")); > > project.executeTarget(taskName); > > project.fireBuildFinished(null); > > }catch(Exception ex){ > > > System.out.println("Exception..."+ex.getMessage()); > > project.fireBuildFinished(ex); > > } > > } > > public static void main(String args[]){ > > try{ > > AntRunnerTest newInst =3D new AntRunnerTest(); > > System.out.println("Before"); > > newInst.executeTask("sql"); > > System.out.println("After"); > > > > }catch(Exception e){System.out.println(""+e);} > > } > > > > } > > > > and the ant build script > > > > > > > > > > > > > driver=3D"${db.mysql.driver}" > > url=3D"${db.mysql.url}" > > userid=3D"${db.mysql.dtsmonitor.username}= " > > password=3D"${db.mysql.dtsmonitor.passwor= d}" > > onerror=3D"continue" > > print=3D"true" > > > > > > > > > > > > > > > > > > > > > > > > > > The debug string "After" never gets printed in the console. > > > > -Jay > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > > For additional commands, e-mail: user-help@ant.apache.org > > > > _________________________________________________________________ > Hotmail: Trusted email with Microsoft's powerful SPAM protection. > http://clk.atdmt.com/GBL/go/177141664/direct/01/ > http://clk.atdmt.com/GBL/go/177141664/direct/01/ > --0016e648d66e5d8e1e04776ccb35--