ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sungho Maeung <smae...@dawning.com>
Subject Re: AW: Problem with startAnt()
Date Thu, 04 Jan 2007 16:03:05 GMT
Hi,
Thank you , Jan.

but I tried and made one class that extends from Main , and added this 
exit() function as follows:
---------------------------------------------------------------
  class ExitAntMain extends org.apache.tools.ant.Main {
    /**
     * This operation is expected to call {@link System#exit(int)}, which
     * is what the base version does.
     *
     * However, it is possible to do something else.
     * @param exitCode code to exit with
     */
    protected void exit(int exitCode) {
      System.out.println("exit(): what is code:"+ exitCode);
      System.exit(exitCode);
    }
  }//ExitAntMain
----------------------------------------------------------------------
and I used the ExitAntMain class as follows:, but it seems to be that it 
does not print out debug output from exit() function.
and I have the same problem that the process of startAnt() does not stop.
Is the exit() override function from Main class ?  It seems to be the 
exit() does not execute.
-------------------------------------------
      String[] args = new String[2];
      args[0] = new String("-f") ;
      args[1] = new String ("Hello\Hello.xml");
      org.apache.tools.ant.launch.AntMain a_oAntExe = new ExitAntMain();
      a_oAntExe.startAnt(args, null, null);
----------------------------------------------
do you have any idea or suggestion that I can try ?

Thank you so much for your comments.

Sungho

Jan.Materne@rzf.fin-nrw.de wrote:
> By default Main calls a System.exit(). You have to subclass it and overwrite exit(int).
>
> Jan
>
>
> Main.java:0238:     /**
> Main.java:0239:      * This operation is expected to call {@link System#exit(int)}, which
> Main.java:0240:      * is what the base version does.
> Main.java:0241:      * However, it is possible to do something else.
> Main.java:0242:      * @param exitCode code to exit with
> Main.java:0243:      */
> Main.java:0244:     protected void exit(int exitCode) {
> Main.java:0245:         System.exit(exitCode);
> Main.java:0246:     }
>
>
>  
>
>   
>> -----Urspr√ľngliche Nachricht-----
>> Von: Sungho Maeung [mailto:smaeung@dawning.com] 
>> Gesendet: Mittwoch, 3. Januar 2007 21:03
>> An: user@ant.apache.org
>> Betreff: Problem with startAnt()
>>
>> Dear Ant User Group.
>>
>> I am having a problem to execute Ant via Java.  After 
>> startAnt() executed, the Hello.xml was done successfully, but  
>> it does not go though the next step which supports to be 
>> printing out the output "Hello, it is done".
>>
>> another strange thing is when i run it on Dos command line as 
>> "C:\>ant -f Hello\Hello.xml", it finished properly. Only it 
>> does not happen via Java Does anyone know about this issue ? 
>> Do I need to something that I do not know?  I have researched 
>> theUserGroup , and Ant manual , but I could not find any 
>> useful information to resolve this problem.
>>
>> I am looking forward to hearing from any of you.
>>
>> Thanks
>> Sungho
>>
>> ===========================================================
>> String[] args = new String[2];
>> args[0] = new String("-f") ;
>> args[1] = new String ("Hello\Hello.xml");
>>     org.apache.tools.ant.launch.AntMain a_oAntExe = new 
>> org.apache.tools.ant.Main(); a_oAntExe.startAnt(args, null, null);
>>     System.out.println("Hello, it is done"); 
>> ===========================================================
>>
>> Hello.xml
>> ---------------------------------------------------------------
>> --------------------------- 
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <project basedir="." default="hibernate-reveng" name="HibernateTools">
>>   <target name="hibernate-reveng">
>>       <taskdef classname="org.hibernate.tool.ant.HibernateToolTask" 
>> classpathref="toolslib" name="hibernatetool" />
>>       <hibernatetool destdir="C:\projects\sniplus-main-10272006">
>>           <jdbcconfiguration packagename="HibernateCfg.Hello" 
>> propertyfile="C:\projects\sniplus-main-10272006\HibernateCfg\He
>> llo\Hello.properties" 
>> />
>>              <hbm2hbmxml 
>> destdir="C:\projects\sniplus-main-10272006" />
>>           <hbm2java />
>>       </hibernatetool>
>>   </target>
>> </project>
>> ---------------------------------------------------------------
>> ------------------------- 
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
>   


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


Mime
View raw message