ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: New Task and Classpath
Date Thu, 28 Aug 2003 20:24:41 GMT
You have not set the classpath.  Your code is
instantiating a new <java> task, then setting its
classpath to the value returned by createClasspath(),
which is a new (and empty) Path.  Your code should not
be nearly as big as it is to be extending the Java
task.  Carefully read what Antoine has suggested,
which is what I had suggested.  Your code should
really consist of not much more than a constructor and
settors for any attributes you may need specific to
the Java class you want to call.  Unless there is
something really special happening it sounds like you
could do what you want without coding Java at all,
just do it all in the xml file with a properly
configured <java> task.

-Matt

--- Aloizio Pereira da Silva <aloizio@dcc.ufmg.br>
wrote:
> I used org.apache.tools.ant.taskdefs because I
> intend to put this task
> like standard ant task. But this is not a problem.
> 
> The problem is I call a java class into the new ant
> task. If you look the
> execute() method it call iniciarGeracao() that
> instantiate
> GeradorRelatorio() class. In this case, during the
> execution the jars
> files is not found. In spite of I have set the
> classpath. 
> 
>  
> 
> 
>            
>
*****************************************************
>             *         Federal University of Minas
> Gerais        *
>             *          Department of Computer
> Science          *
>             *         Master Degree in Computer
> Science         *
>             *                                       
>            *
>             *                 Aloizio Silva         
>            *
>             *        
> http://www.dcc.ufmg.br/~aloizio          *
>             *                                       
>            *
>             *      Mobile Computer and Network
> Optimization     *
>            
>
*****************************************************
>                          
> 
> On Thu, 28 Aug 2003, Antoine Levy-Lambert wrote:
> 
> > 1)the package name of your class does not need to
> be and should not be
> > org.apache.tools.ant.taskdefs,
> > rather should belong to your company's package
> structure
> > 
> > 2) I notice that your class extends the Java task
> of ant, this is fine.
> > In this case you do not need to override methods
> which stay the same such as
> > CreateClasspath.
> > You can rewrite your execute method more simply :
> > 
> > setTaskName("TaskGeraRelatorio");
> >  createArg().setValue(diretorioSaida);
> > createArg().setValue(arqprestacao);
> > createArg().setValue(arqNomeRelatorio);
> > createArg().setValue(banco);
> > createArg().setValue(caminhoBancosInterBase);
> > createArg().setValue(versaoJar);
> > createArg().setValue(usarID);
> > setFork(true);
> > super.execute();
> > 
> > 
> > Antoine
> > ----- Original Message -----
> > From: "Aloizio Pereira da Silva"
> <aloizio@dcc.ufmg.br>
> > To: "Ant Users List" <user@ant.apache.org>
> > Sent: Thursday, August 28, 2003 8:33 PM
> > Subject: Re: New Task and Classpath
> > 
> > 
> > >
> > > This did not work. I am sending attached files
> If anyone could help me.
> > > build.xml e new ant task java class.
> > >
> > > thanks.
> > >
> > >
> > >            
>
*****************************************************
> > >             *         Federal University of
> Minas Gerais        *
> > >             *          Department of Computer
> Science          *
> > >             *         Master Degree in Computer
> Science         *
> > >             *                                   
>                *
> > >             *                 Aloizio Silva     
>                *
> > >             *        
> http://www.dcc.ufmg.br/~aloizio          *
> > >             *                                   
>                *
> > >             *      Mobile Computer and Network
> Optimization     *
> > >            
>
*****************************************************
> > >
> > > On Thu, 28 Aug 2003, Antoine Levy-Lambert wrote:
> > >
> > > > You should set in the classpath that you
> define in build.xml your new
> > task
> > > > and all its dependencies.
> > > > Also none of these should be in the CLASSPATH
> environment variable
> > before
> > > > you start ant.
> > > > If this does not help, can you post your
> build.xml
> > > > Antoine
> > > > ----- Original Message -----
> > > > From: "Aloizio Pereira da Silva"
> <aloizio@dcc.ufmg.br>
> > > > To: "Ant Users List" <user@ant.apache.org>
> > > > Sent: Thursday, August 28, 2003 6:59 PM
> > > > Subject: Re: New Task and Classpath
> > > >
> > > >
> > > > >
> > > > > I made what you suggested. But, my ant task
> java class has a call for
> > > > > another java class that use some libraries.
> And I set this libraries
> > > > > in Build.xml. Then I get the following
> error:
> > > > >
> > > > > Why the setting classpath does not remain to
> the another java class?
> > > > > BUILD FAILED
> > > > > java.lang.NoClassDefFoundError:
> > > >
> synergia/persistencia/principal/ExcecaoPersisten
> > > > > cia  at
> > > > >
>
org.apache.tools.ant.taskdefs.TaskGeraRelatorio.iniciarGeracao(Unknow
> > > > > n Source) at
> > > > >
>
org.apache.tools.ant.taskdefs.TaskGeraRelatorio.execute(Unknown
> > > > > Source)
> > > > >
> > > > >            
>
*****************************************************
> > > > >             *         Federal University of
> Minas Gerais        *
> > > > >             *          Department of
> Computer Science          *
> > > > >             *         Master Degree in
> Computer Science         *
> > > > >             *                               
>                    *
> > > > >             *                 Aloizio Silva 
>                    *
> > > > >             *        
> http://www.dcc.ufmg.br/~aloizio          *
> > > > >             *                               
>                    *
> > > > >             *      Mobile Computer and
> Network Optimization     *
> > > > >            
>
*****************************************************
> > > > >
> > > > > On 28 Aug 2003, Stefan Bodewig wrote:
> > > > >
> > > > > > On Wed, 27 Aug 2003, Aloizio Pereira da
> Silva <aloizio@dcc.ufmg.br>
> > > > > > wrote:
> > > > > >
> > > > > > > messages: [gerar_relatorio]
> java.lang.NoClassDefFoundError:
> > > > > > > org/apache/tools/ant/Task
> > > > > >
> > > > > > You need to add ant.jar to the <classpath>
> explicitly (or do that
> > > > > > inside of execute() as the <java> task
> that you use internally tries
> > > > > > to keep the environment clean of Ant's own
> classes.
> > > > > >
> > > > > > Stefan
> > > > > >
> > > > >
> > >
>
---------------------------------------------------------------------
> > > > > > 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
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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


Mime
View raw message