Problem to use ant contrib

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

Problem to use ant contrib

by Dubois, Fabien :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everybody,

 

I try to use ant-contrib to create a task which detects if a file is
present, and if not copy the file in the folder.

So I have get back the source of ant-contrib, build and create the jar.

 

This is my task :

 

      <target name="local.deploy.init"

      description="copy the jdbc librairy in the $CATALINA_HOME/lib">

          <taskdef uri="antlib:net.sf.antcontrib"

          resource="net/sf/antcontrib/cpptasks/antlib.xml"

          classpath="${lib}/cpptasks.jar"/>

            <if>

             <fail
file="${tomcat}/lib/mysql-connector-java-5.1.5-bin.jar"/>

                  <then>

                        <copy todir="${tomcat}/lib">

                             <fileset
file="${lib}/mysql-connector-java-5.1.5-bin.jar"/>

                        </copy>

                  </then>

            </if>

      </target>

 

Ant stops this task at the < if > (so there is no problem for the
taskdef):

D:\workspace\appWicket\trunk\build.xml:81: Problem: failed to create
task or type if

Cause: The name is undefined.

Action: Check the spelling.

Action: Check that any custom tasks/types have been declared.

Action: Check that any <presetdef>/<macrodef> declarations have taken
place.

 

Moreover sourceforge is currently off, so I can't verify the syntax.

 

If you can help me, thank you in advance :-)


Re: Problem to use ant contrib

by Stefan Bodewig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 30 Apr 2008, Fabien Dubois <fabien.dubois@...> wrote:

>           <taskdef uri="antlib:net.sf.antcontrib"
>           resource="net/sf/antcontrib/cpptasks/antlib.xml"
>           classpath="${lib}/cpptasks.jar"/>
>
>             <if>
>
> Ant stops this task at the < if > (so there is no problem for the
> taskdef):

I don't think cpptasks.jar contains the if-task, you need the
ant-contrib.jar for that.

Stefan

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


Re: Problem to use ant contrib

by Peter Reilly-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Also, the taskdef defines a namespace uri (antlib:net.sf.antcontrib)
but the script does not bind this to a namespace prefix and in any
case does not use a namespace prefix with the <if> tag.

the definition should be something like this:
<taskdef resource="net/sf/antcontrib/antlib.xml"
              classpath="${lib}/antcontrib.jar"/>
<if>
...

or (ant 1.7)
<taskdef uri="antlib:net.sf.antcontrib"
             classpath="${lib}/antcontrib.jar"/>

<ac:if xmlns:ac=""antlib:net.sf.antcontrib">

..
</ac:if>


Peter


On Wed, Apr 30, 2008 at 9:54 AM, Stefan Bodewig <bodewig@...> wrote:

> On Wed, 30 Apr 2008, Fabien Dubois <fabien.dubois@...> wrote:
>
>  >           <taskdef uri="antlib:net.sf.antcontrib"
>  >           resource="net/sf/antcontrib/cpptasks/antlib.xml"
>  >           classpath="${lib}/cpptasks.jar"/>
>  >
>  >             <if>
>  >
>
> > Ant stops this task at the < if > (so there is no problem for the
>  > taskdef):
>
>  I don't think cpptasks.jar contains the if-task, you need the
>  ant-contrib.jar for that.
>
>  Stefan
>
>  ---------------------------------------------------------------------
>  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: Problem to use ant contrib

by Dubois, Fabien :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Where I can find ant-contrib.jar?? because source forge is off...

Thank you

-----Message d'origine-----
De : Stefan Bodewig [mailto:bodewig@...]
Envoyé : mercredi 30 avril 2008 10:54
À : user@...
Objet : Re: Problem to use ant contrib

On Wed, 30 Apr 2008, Fabien Dubois <fabien.dubois@...> wrote:

>           <taskdef uri="antlib:net.sf.antcontrib"
>           resource="net/sf/antcontrib/cpptasks/antlib.xml"
>           classpath="${lib}/cpptasks.jar"/>
>
>             <if>
>
> Ant stops this task at the < if > (so there is no problem for the
> taskdef):

I don't think cpptasks.jar contains the if-task, you need the
ant-contrib.jar for that.

Stefan

---------------------------------------------------------------------
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@...