ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashutosh Kumar" <ashutosh.ku...@ionidea.com>
Subject RE: calling ant from java program
Date Thu, 26 Aug 2004 14:17:02 GMT
I am trying tt call ant from java program without using build.xml
If build.xml is like this 
<taskdef 
    name="wlconfig" 
     classname="weblogic.ant.taskdefs.management.WLConfig"
             classpath="${pcmjarpath}"/>
<target name="test_config" >  
  <wlserver username="weblogic" 
            password="weblogic" 
            servername="myserver"      
            domainname="pcmdomain" 
            dir="F:/beasp3/user_projects/domains/pcmdomain" 
            host="localhost" 
            port="7001"      
            generateconfig="false"/>

The java program will be like 

         Project project = new Project();
         Class wlConfigtaskDef=null;
          try {
            wlConfigtaskDef=
Class.forName("weblogic.ant.taskdefs.management.WLConfig");

          }
          catch (ClassNotFoundException ex) {

         }

          project.addTaskDefinition("wlconfig",wlConfigtaskDef);
          Target configWeblogic=new Target();
          configWeblogic.setName("test_config");
          Task t= project.createTask("wlserver");
          t.setTaskName("wlserver");
          configWeblogic.addTask(t);
          project.addTarget(configWeblogic);
          project.setNewProperty("username","weblogic");// this
setAttribute 			should be attached to task i.e wlserver,
not to project.  			I am 		not getting API
for it.



 Regds

Ashutosh        

   


-----Original Message-----
From: Olivier Croisier [mailto:Olivier.Croisier@thales-is.com] 
Sent: Thursday, August 26, 2004 1:44 PM
To: Ant Users List
Subject: Re: calling ant from java program

Hi

Hummm I dont see why it doesn't work for you...
Maybe it is a matter of Ant versionning ? I use the latest stable build
(1.6.2 I think).

The error stack trace seems to point out a Sax error, as if the parser
couldn't properly manage some element in the build file. Or it may come
from the ProjectHelper class, that performs some standart initialization
of the Project object.

Again, I would recommend trying with the latest versions (parser, ant,
etc.).
Or, if you can't change, try to see how to initialize the Project
manually, ie without using the ProjectHelper ?

Please keep me informed of your problems/successes !

PS : anyone experiencing similar problems with my class ?

-- 
CROISIER Olivier
Software Engineer
Thales IS - ANS
olivier.croisier@thales-is.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message