From user-return-36984-apmail-ant-user-archive=ant.apache.org@ant.apache.org Thu Sep 18 16:32:17 2003 Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 92366 invoked from network); 18 Sep 2003 16:32:16 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 18 Sep 2003 16:32:16 -0000 Received: (qmail 27644 invoked by uid 500); 18 Sep 2003 16:31:57 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 27601 invoked by uid 500); 18 Sep 2003 16:31:57 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 27587 invoked from network); 18 Sep 2003 16:31:57 -0000 Received: from unknown (HELO 137100.vserver.de) (62.75.137.100) by daedalus.apache.org with SMTP; 18 Sep 2003 16:31:57 -0000 Received: from D2CFT80J (localhost.localdomain [127.0.0.1]) (authenticated) by 137100.vserver.de (8.11.6/8.11.6) with ESMTP id h8IGVsd02051 for ; Thu, 18 Sep 2003 18:31:58 +0200 From: =?us-ascii?Q?Antoine_Levy-Lambert?= To: "Ant Users List" Subject: AW: little help please...Exception:Class org.apache.tools.ant.UnknownElement doesn't support the "name" attribute Date: Thu, 18 Sep 2003 18:31:07 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 In-Reply-To: <20030918155540.74169.qmail@web20706.mail.yahoo.com> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Here is a sample of how you can use the ant api to run targets. I am not using the AntTarget class here, just the Project class. Maybe this makes a difference. Cheers, Antoine public class testjartask { public static void main (String [] argv){ //String filename="/dev/testant/build.xml"; String filename="/dev/gnu/ant/jakarta-ant/src/etc/testcases/taskdefs/jar.xml"; StringBuffer logBuffer; StringBuffer fullLogBuffer; Project project=new Project(); logBuffer = new StringBuffer(); fullLogBuffer = new StringBuffer(); project = new Project(); project.init(); project.setUserProperty( "ant.file" , new File(filename).getAbsolutePath() ); ProjectHelper.configureProject(project, new File(filename)); project.addBuildListener(createLogger()); //project.executeTarget("cleanup"); project.executeTarget("test4"); project.executeTarget("testRecreateNewerFileSetup"); project.executeTarget("testRecreateWithUpdateNewerFile"); } private static BuildLogger createLogger() { BuildLogger logger = null; logger = new DefaultLogger(); logger.setMessageOutputLevel(Project.MSG_INFO); logger.setOutputPrintStream(System.out); logger.setErrorPrintStream(System.err); logger.setEmacsMode(false); return logger; } } -----Ursprungliche Nachricht----- Von: teoman teoman [mailto:teoman872@yahoo.com] Gesendet: Donnerstag, 18. September 2003 17:56 An: user@ant.apache.org Betreff: little help please...Exception:Class org.apache.tools.ant.UnknownElement doesn't support the "name" attribute hi all, I am calling an ant build file from a java class...first I am loading the build file into my project object: Project oProject = new AntTarget(); File buildFile = new File(file); oProject.setUserProperty("ant.file",buildFile.getAbsolutePath()); ProjectHelper.configureProject(oProject,buildFile); oProject.executeTarget(target);//executes the specified target and I am getting exception like that: Sep 18, 2003 10:47:12 AM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=2/59 config=/export/home/amustaco/jakarta-tomcat-4.1.18/conf/jk2.properties runTarget Exception:Class org.apache.tools.ant.UnknownElement doesn't support the "name" attribute. Class org.apache.tools.ant.UnknownElement doesn't support the "name" attribute. at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.ja va:422) thank you so much in advance.. teoman --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org