Problem with the classpath embedding ant

View: New views
7 Messages — Rating Filter:   Alert me  

Problem with the classpath embedding ant

by chuchi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

    I'm trying to embed ant into an application but I have a lot of
problems. I have tried to change the classloader, and when I call to
java task all works fine but if I put a taskdef ant cannot find the
class.

Example:

<?xml version="1.0" encoding="ISO-8859-15" ?>
<project name="TestLoaderDemonio" default="defecto" basedir=".">
        <description>
                Prueba cargador de librerias
        </description>

        <taskdef name="mitask" classname="test.TestTask" />
        <target name="defecto" description="Único target que se lanza desde
QDemonio" >
                <java classname="test.TestLoaderDemonio" failonerror="true"
outputproperty="outputproperty"
                         errorproperty="errorproperty">
                <classpath>
           <pathelement path="${java.class.path}"/>
         </classpath>
                </java>
                <echo message="Out: ${outputproperty}"/>
                <echo message="Error: ${errorproperty}"/>
                <mitask mensaje="Lanzamos mi task" />
        </target>
</project>

If I execute ant in the command line all  works fine:

ant -f buildLoader.xml
-lib /home/chuchi/wd/QDemonioTareas/src/test/resources -debug

But if I execute the Launcher from a java class, It does not work:

public static void main(String[] args) {
     String args2[] = {
          "-f",

TestLoaderExtDemonio.class.getResource("/buildLoader.xml").getPath(),
          "-lib",
          "/home/chuchi/wd/QDemonioTareas/src/test/resources",
          "-debug"
     };
     Launcher.main(args2);
}

The error is a ClassNotFoundException (test.TestTask)

Can you help me? I have been reading two days in FAQ, List, Google...
But I cannot see any solution

Regards,
    Chuchi

 
Pulse para ir al sitio web  
Jesús Barbero Rodríguez
Departamento de Análisis y Programación - Desarrollo tecnológico
Zoco Gran Santander, 1ª Planta ■ 39011 Peñacastillo ■ Santander ■ ESPAÑA

Tel.: +34 902 233 323 ■ Fax: +34 902 234 280




AVISO LEGAL: Este mensaje contiene información destinada exclusivamente
al usuario de destino, pudiendo contener información confidencial o
protegida legalmente. Si, por un error de envío o transmisión, ha
recibido este mensaje y usted no es el destinatario del mismo, por
favor, notifique de este hecho al remitente y no use, informe,
distribuya, imprima, copie o difunda este mensaje bajo ningún medio .
Cualquier opinión en él contenida, es exclusiva de su autor y no
representa necesariamente la opinión de Quiter Servicios Informáticos,
S.L.

LEGAL WARNING: This e-mail and any attachment, contain information
intended solely for the addressee and may contain confidential
information or legally protected data. If you are not the intended
recipient, please notify the sender and do not use, disclose,
distribute, copy, print or rely on this e-mail under any circumstances.
The views and opinions expressed are the authorŽs own and do not
necessarily reflect those of Quiter Servicios Informáticos, S.L.  





Re: Problem with the classpath embedding ant

by chuchi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again,

    If I comment the <taskdef...> and the <mitask...> works fine. As you
can see, the java task load the libraries correctly but the taskdef task
not


El mar, 08-07-2008 a las 17:36 +0200, chuchi escribió:

> Hi all,
>
>     I'm trying to embed ant into an application but I have a lot of
> problems. I have tried to change the classloader, and when I call to
> java task all works fine but if I put a taskdef ant cannot find the
> class.
>
> Example:
>
> <?xml version="1.0" encoding="ISO-8859-15" ?>
> <project name="TestLoaderDemonio" default="defecto" basedir=".">
> <description>
> Prueba cargador de librerias
> </description>
>
> <taskdef name="mitask" classname="test.TestTask" />
> <target name="defecto" description="Único target que se lanza desde
> QDemonio" >
> <java classname="test.TestLoaderDemonio" failonerror="true"
> outputproperty="outputproperty"
> errorproperty="errorproperty">
> <classpath>
>            <pathelement path="${java.class.path}"/>
>          </classpath>
> </java>
> <echo message="Out: ${outputproperty}"/>
> <echo message="Error: ${errorproperty}"/>
> <mitask mensaje="Lanzamos mi task" />
> </target>
> </project>
>
> If I execute ant in the command line all  works fine:
>
> ant -f buildLoader.xml
> -lib /home/chuchi/wd/QDemonioTareas/src/test/resources -debug
>
> But if I execute the Launcher from a java class, It does not work:
>
> public static void main(String[] args) {
>      String args2[] = {
>           "-f",
>
> TestLoaderExtDemonio.class.getResource("/buildLoader.xml").getPath(),
>           "-lib",
>           "/home/chuchi/wd/QDemonioTareas/src/test/resources",
>           "-debug"
>      };
>      Launcher.main(args2);
> }
>
> The error is a ClassNotFoundException (test.TestTask)
>
> Can you help me? I have been reading two days in FAQ, List, Google...
> But I cannot see any solution
>
> Regards,
>     Chuchi
>
>  
> Pulse para ir al sitio web  
> Jesús Barbero Rodríguez
> Departamento de Análisis y Programación - Desarrollo tecnológico
> Zoco Gran Santander, 1ª Planta ■ 39011 Peñacastillo ■ Santander ■ ESPAÑA
>
> Tel.: +34 902 233 323 ■ Fax: +34 902 234 280
>
>
>
>
> AVISO LEGAL: Este mensaje contiene información destinada exclusivamente
> al usuario de destino, pudiendo contener información confidencial o
> protegida legalmente. Si, por un error de envío o transmisión, ha
> recibido este mensaje y usted no es el destinatario del mismo, por
> favor, notifique de este hecho al remitente y no use, informe,
> distribuya, imprima, copie o difunda este mensaje bajo ningún medio .
> Cualquier opinión en él contenida, es exclusiva de su autor y no
> representa necesariamente la opinión de Quiter Servicios Informáticos,
> S.L.
>
> LEGAL WARNING: This e-mail and any attachment, contain information
> intended solely for the addressee and may contain confidential
> information or legally protected data. If you are not the intended
> recipient, please notify the sender and do not use, disclose,
> distribute, copy, print or rely on this e-mail under any circumstances.
> The views and opinions expressed are the authorŽs own and do not
> necessarily reflect those of Quiter Servicios Informáticos, S.L.  
>
>
>
>

 
Pulse para ir al sitio web  
Jesús Barbero Rodríguez
Departamento de Análisis y Programación - Desarrollo tecnológico
Zoco Gran Santander, 1ª Planta ■ 39011 Peñacastillo ■ Santander ■ ESPAÑA

Tel.: +34 902 233 323 ■ Fax: +34 902 234 280




AVISO LEGAL: Este mensaje contiene información destinada exclusivamente
al usuario de destino, pudiendo contener información confidencial o
protegida legalmente. Si, por un error de envío o transmisión, ha
recibido este mensaje y usted no es el destinatario del mismo, por
favor, notifique de este hecho al remitente y no use, informe,
distribuya, imprima, copie o difunda este mensaje bajo ningún medio .
Cualquier opinión en él contenida, es exclusiva de su autor y no
representa necesariamente la opinión de Quiter Servicios Informáticos,
S.L.

LEGAL WARNING: This e-mail and any attachment, contain information
intended solely for the addressee and may contain confidential
information or legally protected data. If you are not the intended
recipient, please notify the sender and do not use, disclose,
distribute, copy, print or rely on this e-mail under any circumstances.
The views and opinions expressed are the authorŽs own and do not
necessarily reflect those of Quiter Servicios Informáticos, S.L.  





substring

by Anthony Muller-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

Is it possible to do a substring operation with Ant?

Cheers,
Anthony

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


Re: substring

by Garrett :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jul 8, 2008 at 12:51 PM, Anthony Muller <anthony.muller@...> wrote:
> Hello,
>
> Is it possible to do a substring operation with Ant?
>
Not exactly.

But it is possible to do a string/token replacement -- not exactly
what you asked, but it can get the job done. This is done using a
FilterChain, http://ant.apache.org/manual/CoreTypes/filterchain.html

I'm using this feature to replace certain strings in my files with the
empty string (removal). In the example below, I replace "from" with
"to"
from: "APE.namespace("APE.dom");"
to:    ""


http://dhtmlkitchen.com/ape/build.xml
<concat destfile="${src}/dom/_dom.js">
<filelist dir="${src}/dom" files="viewport-f.js, position-f.js,
classname-f.js, traversal-f.js, Event.js"/>
  <filterchain>
    <tokenfilter>
      <replacestring from="APE.namespace("APE.dom");" to=""/>
      <replacestring from="APE.namespace('APE.dom');" to=""/>
    </tokenfilter>
  </filterchain>
</concat>

Garrett

> Cheers,
> Anthony

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


Re: substring

by Frank Harnack :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Anthony,

the StringUtils task from antelope should help you.

http://antelope.tigris.org/docs/manual/bk03ch13.html

Regards

Frank

Quoting Anthony Muller <anthony.muller@...>:

> Hello,
>
> Is it possible to do a substring operation with Ant?
>
> Cheers,
> Anthony
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>




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


RE: substring

by Shawn Castrianni-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, but not with standard ANT. You have to use the stringutils plugin from antelope with docs here:  http://antelope.tigris.org/nonav/docs/manual/bk03ch13.html


---
Shawn Castrianni

-----Original Message-----
From: Anthony Muller [mailto:anthony.muller@...]
Sent: Tuesday, July 08, 2008 9:51 PM
To: Ant Users List
Subject: substring

Hello,

Is it possible to do a substring operation with Ant?

Cheers,
Anthony

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

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient.  Any review, use, distribution, or disclosure by others is strictly prohibited.  If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

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


RE: substring

by Anthony Muller-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the tip!

-----Original Message-----
From: Garrett Smith [mailto:dhtmlkitchen@...]
Sent: Wednesday, July 09, 2008 8:22 AM
To: Ant Users List
Subject: Re: substring

On Tue, Jul 8, 2008 at 12:51 PM, Anthony Muller <anthony.muller@...>
wrote:
> Hello,
>
> Is it possible to do a substring operation with Ant?
>
Not exactly.

But it is possible to do a string/token replacement -- not exactly
what you asked, but it can get the job done. This is done using a
FilterChain, http://ant.apache.org/manual/CoreTypes/filterchain.html

I'm using this feature to replace certain strings in my files with the
empty string (removal). In the example below, I replace "from" with
"to"
from: "APE.namespace("APE.dom");"
to:    ""


http://dhtmlkitchen.com/ape/build.xml
<concat destfile="${src}/dom/_dom.js">
<filelist dir="${src}/dom" files="viewport-f.js, position-f.js,
classname-f.js, traversal-f.js, Event.js"/>
  <filterchain>
    <tokenfilter>
      <replacestring from="APE.namespace("APE.dom");" to=""/>
      <replacestring from="APE.namespace('APE.dom');" to=""/>
    </tokenfilter>
  </filterchain>
</concat>

Garrett

> Cheers,
> Anthony

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


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