You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dharmesh Vyas <dh...@gmail.com> on 2006/11/24 14:53:06 UTC

[HELP] How to use ant-contrib inside an ant plugin?

Hello Group,

I am a new member of the group. I am trying to use ant-contrib plugin with
ant. I have been facing an issue where in it shows that "Could not create
task or type of type: for."

The full error that I get is:

******************************************************************************************D:\Projects\Ant-trials\ant-tasks\BuildTestEnv.xml:42:
Could not create task or t
ype of type: for.

Ant could not find the task or a class this task relies upon.

This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
 - You have misspelt 'for'.
   Fix: check your spelling.
 - The task needs an external JAR file to execute
     and this is not found at the right place in the classpath.
   Fix: check the documentation for dependencies.
   Fix: declare the task.
 - The task is an Ant optional task and the JAR file and/or libraries
     implementing the functionality were not found at the time you
     yourself built your installation of Ant from the Ant sources.
   Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
     task and make sure it contains more than merely a META-INF/MANIFEST.MF.

     If all it contains is the manifest, then rebuild Ant with the needed
     libraries present in ${ant.home}/lib/optional/ , or alternatively,
     download a pre-built release version from apache.org
 - The build file was written for a later version of Ant
   Fix: upgrade to at least the latest release version of Ant
 - The task is not an Ant core or optional task
     and needs to be declared using <taskdef>.
 - You are attempting to use a task defined using
    <presetdef> or <macrodef> but have spelt wrong or not
   defined it at the point of use

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath

Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.
******************************************************************************************
I have the ant 1.6.3 and ant-contrib 1.0b3-bin on my machine. I have copied
jar file of ant-contrib in to ant/lib and the initial name of jar file was '
ant-contrib-1.0b3', I was not sure if this name has to be changed to
ant-contrib or antcontrib. But to give it a try, I have tried out that also
but din't work for me.

This is how I am using the "For" task in my build.xml file

 <target name="useoffor">
  <for param="i" begin="0" step="1" end="5">
       <sequential>
         <echo>i is @{i}</echo>
       </sequential>
     </for>
  </target>

To use "for" task do i need to define any thing else also in my
build.xmlfile ? Please let me know where am I going wrong.

Thanks a lot in Advance,
- Dharmesh Vyas

Re: [HELP] How to use ant-contrib inside an ant plugin?

Posted by Peter Reilly <pe...@gmail.com>.
On 11/27/06, Scot P. Floess <fl...@mindspring.com> wrote:
> Am I missing something?  Does ant-contrib's <for> task support this kind
> of "for" looping?
>
It has been recently added, and a new release of ant-contrib
(1.0b3) picked it up.

Peter


> Dharmesh Vyas wrote:
> > Hello,
> >
> > Thanks for the reply and suggestion Peter. I tried out a thing and it
> > worked
> > for me. Here it is.
> > Set the classpath till directory net and then you need to include this
> > taskdef.
> >      <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" />
> > in your script and the script is running all fine and well..
> >
> > I shall try out the solution Peter provided.
> >
> > Thanks and Regards,
> > - Dharmesh Vyas.
> >
> > On 11/24/06, Peter Reilly <pe...@gmail.com> wrote:
> >>
> >> Use the antlib:net.sf.antcontrib namespace
> >>
> >> <ac:for param="i" begin="0" step="1" end="5" xmns:ac="antlib:
> >> net.sf.antcontrib">
> >>      <sequential>
> >>        <echo>i is @{i}</echo>
> >>      </sequential>
> >> </ac:for>
> >>
> >> Also, you should upgrade to ant 1.6.5 as ant1.6.5 fixes
> >> a number of bugs found in ant 1.6.3.
> >>
> >> (or ant 1.7.0 when it comes out in a few weeks).
> >>
> >> Peter
> >>
> >>
> >> On 11/24/06, Dharmesh Vyas <dh...@gmail.com> wrote:
> >> > Hello Group,
> >> >
> >> > I am a new member of the group. I am trying to use ant-contrib plugin
> >> with
> >> > ant. I have been facing an issue where in it shows that "Could not
> >> create
> >> > task or type of type: for."
> >> >
> >> > The full error that I get is:
> >> >
> >> >
> >> ******************************************************************************************D:\Projects\Ant-trials\ant-tasks\BuildTestEnv.xml:42:
> >>
> >> > Could not create task or t
> >> > ype of type: for.
> >> >
> >> > Ant could not find the task or a class this task relies upon.
> >> >
> >> > This is common and has a number of causes; the usual
> >> > solutions are to read the manual pages then download and
> >> > install needed JAR files, or fix the build file:
> >> >  - You have misspelt 'for'.
> >> >    Fix: check your spelling.
> >> >  - The task needs an external JAR file to execute
> >> >      and this is not found at the right place in the classpath.
> >> >    Fix: check the documentation for dependencies.
> >> >    Fix: declare the task.
> >> >  - The task is an Ant optional task and the JAR file and/or libraries
> >> >      implementing the functionality were not found at the time you
> >> >      yourself built your installation of Ant from the Ant sources.
> >> >    Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding
> >> to the
> >> >      task and make sure it contains more than merely a
> >> META-INF/MANIFEST.MF.
> >> >
> >> >      If all it contains is the manifest, then rebuild Ant with the
> >> needed
> >> >      libraries present in ${ant.home}/lib/optional/ , or
> >> alternatively,
> >> >      download a pre-built release version from apache.org
> >> >  - The build file was written for a later version of Ant
> >> >    Fix: upgrade to at least the latest release version of Ant
> >> >  - The task is not an Ant core or optional task
> >> >      and needs to be declared using <taskdef>.
> >> >  - You are attempting to use a task defined using
> >> >     <presetdef> or <macrodef> but have spelt wrong or not
> >> >    defined it at the point of use
> >> >
> >> > Remember that for JAR files to be visible to Ant tasks implemented
> >> > in ANT_HOME/lib, the files must be in the same directory or on the
> >> > classpath
> >> >
> >> > Please neither file bug reports on this problem, nor email the
> >> > Ant mailing lists, until all of these causes have been explored,
> >> > as this is not an Ant bug.
> >> >
> >> ******************************************************************************************
> >>
> >> > I have the ant 1.6.3 and ant-contrib 1.0b3-bin on my machine. I have
> >> copied
> >> > jar file of ant-contrib in to ant/lib and the initial name of jar file
> >> was '
> >> > ant-contrib-1.0b3', I was not sure if this name has to be changed to
> >> > ant-contrib or antcontrib. But to give it a try, I have tried out that
> >> also
> >> > but din't work for me.
> >> >
> >> > This is how I am using the "For" task in my build.xml file
> >> >
> >> >  <target name="useoffor">
> >> >   <for param="i" begin="0" step="1" end="5">
> >> >        <sequential>
> >> >          <echo>i is @{i}</echo>
> >> >        </sequential>
> >> >      </for>
> >> >   </target>
> >> >
> >> > To use "for" task do i need to define any thing else also in my
> >> > build.xmlfile ? Please let me know where am I going wrong.
> >> >
> >> > Thanks a lot in Advance,
> >> > - Dharmesh Vyas
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> >> For additional commands, e-mail: user-help@ant.apache.org
> >>
> >>
> >
>
> --
> Scot P. Floess
> 27 Lake Royale
> Louisburg, NC  27549
>
> 252-478-8087 (Home)
> 919-754-4592 (Work)
>
> Chief Architect JPlate  http://sourceforge.net/projects/jplate
> Chief Architect JavaPIM http://sourceforge.net/projects/javapim
>
>
> ---------------------------------------------------------------------
> 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


Re: [HELP] How to use ant-contrib inside an ant plugin?

Posted by "Scot P. Floess" <fl...@mindspring.com>.
Am I missing something?  Does ant-contrib's <for> task support this kind 
of "for" looping?

Dharmesh Vyas wrote:
> Hello,
>
> Thanks for the reply and suggestion Peter. I tried out a thing and it 
> worked
> for me. Here it is.
> Set the classpath till directory net and then you need to include this
> taskdef.
>      <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" />
> in your script and the script is running all fine and well..
>
> I shall try out the solution Peter provided.
>
> Thanks and Regards,
> - Dharmesh Vyas.
>
> On 11/24/06, Peter Reilly <pe...@gmail.com> wrote:
>>
>> Use the antlib:net.sf.antcontrib namespace
>>
>> <ac:for param="i" begin="0" step="1" end="5" xmns:ac="antlib:
>> net.sf.antcontrib">
>>      <sequential>
>>        <echo>i is @{i}</echo>
>>      </sequential>
>> </ac:for>
>>
>> Also, you should upgrade to ant 1.6.5 as ant1.6.5 fixes
>> a number of bugs found in ant 1.6.3.
>>
>> (or ant 1.7.0 when it comes out in a few weeks).
>>
>> Peter
>>
>>
>> On 11/24/06, Dharmesh Vyas <dh...@gmail.com> wrote:
>> > Hello Group,
>> >
>> > I am a new member of the group. I am trying to use ant-contrib plugin
>> with
>> > ant. I have been facing an issue where in it shows that "Could not
>> create
>> > task or type of type: for."
>> >
>> > The full error that I get is:
>> >
>> >
>> ******************************************************************************************D:\Projects\Ant-trials\ant-tasks\BuildTestEnv.xml:42: 
>>
>> > Could not create task or t
>> > ype of type: for.
>> >
>> > Ant could not find the task or a class this task relies upon.
>> >
>> > This is common and has a number of causes; the usual
>> > solutions are to read the manual pages then download and
>> > install needed JAR files, or fix the build file:
>> >  - You have misspelt 'for'.
>> >    Fix: check your spelling.
>> >  - The task needs an external JAR file to execute
>> >      and this is not found at the right place in the classpath.
>> >    Fix: check the documentation for dependencies.
>> >    Fix: declare the task.
>> >  - The task is an Ant optional task and the JAR file and/or libraries
>> >      implementing the functionality were not found at the time you
>> >      yourself built your installation of Ant from the Ant sources.
>> >    Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding 
>> to the
>> >      task and make sure it contains more than merely a
>> META-INF/MANIFEST.MF.
>> >
>> >      If all it contains is the manifest, then rebuild Ant with the
>> needed
>> >      libraries present in ${ant.home}/lib/optional/ , or 
>> alternatively,
>> >      download a pre-built release version from apache.org
>> >  - The build file was written for a later version of Ant
>> >    Fix: upgrade to at least the latest release version of Ant
>> >  - The task is not an Ant core or optional task
>> >      and needs to be declared using <taskdef>.
>> >  - You are attempting to use a task defined using
>> >     <presetdef> or <macrodef> but have spelt wrong or not
>> >    defined it at the point of use
>> >
>> > Remember that for JAR files to be visible to Ant tasks implemented
>> > in ANT_HOME/lib, the files must be in the same directory or on the
>> > classpath
>> >
>> > Please neither file bug reports on this problem, nor email the
>> > Ant mailing lists, until all of these causes have been explored,
>> > as this is not an Ant bug.
>> >
>> ****************************************************************************************** 
>>
>> > I have the ant 1.6.3 and ant-contrib 1.0b3-bin on my machine. I have
>> copied
>> > jar file of ant-contrib in to ant/lib and the initial name of jar file
>> was '
>> > ant-contrib-1.0b3', I was not sure if this name has to be changed to
>> > ant-contrib or antcontrib. But to give it a try, I have tried out that
>> also
>> > but din't work for me.
>> >
>> > This is how I am using the "For" task in my build.xml file
>> >
>> >  <target name="useoffor">
>> >   <for param="i" begin="0" step="1" end="5">
>> >        <sequential>
>> >          <echo>i is @{i}</echo>
>> >        </sequential>
>> >      </for>
>> >   </target>
>> >
>> > To use "for" task do i need to define any thing else also in my
>> > build.xmlfile ? Please let me know where am I going wrong.
>> >
>> > Thanks a lot in Advance,
>> > - Dharmesh Vyas
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


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


Re: [HELP] How to use ant-contrib inside an ant plugin?

Posted by Dharmesh Vyas <dh...@gmail.com>.
Hello,

Thanks for the reply and suggestion Peter. I tried out a thing and it worked
for me. Here it is.
Set the classpath till directory net and then you need to include this
taskdef.
      <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" />
in your script and the script is running all fine and well..

I shall try out the solution Peter provided.

Thanks and Regards,
- Dharmesh Vyas.

On 11/24/06, Peter Reilly <pe...@gmail.com> wrote:
>
> Use the antlib:net.sf.antcontrib namespace
>
> <ac:for param="i" begin="0" step="1" end="5" xmns:ac="antlib:
> net.sf.antcontrib">
>      <sequential>
>        <echo>i is @{i}</echo>
>      </sequential>
> </ac:for>
>
> Also, you should upgrade to ant 1.6.5 as ant1.6.5 fixes
> a number of bugs found in ant 1.6.3.
>
> (or ant 1.7.0 when it comes out in a few weeks).
>
> Peter
>
>
> On 11/24/06, Dharmesh Vyas <dh...@gmail.com> wrote:
> > Hello Group,
> >
> > I am a new member of the group. I am trying to use ant-contrib plugin
> with
> > ant. I have been facing an issue where in it shows that "Could not
> create
> > task or type of type: for."
> >
> > The full error that I get is:
> >
> >
> ******************************************************************************************D:\Projects\Ant-trials\ant-tasks\BuildTestEnv.xml:42:
> > Could not create task or t
> > ype of type: for.
> >
> > Ant could not find the task or a class this task relies upon.
> >
> > This is common and has a number of causes; the usual
> > solutions are to read the manual pages then download and
> > install needed JAR files, or fix the build file:
> >  - You have misspelt 'for'.
> >    Fix: check your spelling.
> >  - The task needs an external JAR file to execute
> >      and this is not found at the right place in the classpath.
> >    Fix: check the documentation for dependencies.
> >    Fix: declare the task.
> >  - The task is an Ant optional task and the JAR file and/or libraries
> >      implementing the functionality were not found at the time you
> >      yourself built your installation of Ant from the Ant sources.
> >    Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
> >      task and make sure it contains more than merely a
> META-INF/MANIFEST.MF.
> >
> >      If all it contains is the manifest, then rebuild Ant with the
> needed
> >      libraries present in ${ant.home}/lib/optional/ , or alternatively,
> >      download a pre-built release version from apache.org
> >  - The build file was written for a later version of Ant
> >    Fix: upgrade to at least the latest release version of Ant
> >  - The task is not an Ant core or optional task
> >      and needs to be declared using <taskdef>.
> >  - You are attempting to use a task defined using
> >     <presetdef> or <macrodef> but have spelt wrong or not
> >    defined it at the point of use
> >
> > Remember that for JAR files to be visible to Ant tasks implemented
> > in ANT_HOME/lib, the files must be in the same directory or on the
> > classpath
> >
> > Please neither file bug reports on this problem, nor email the
> > Ant mailing lists, until all of these causes have been explored,
> > as this is not an Ant bug.
> >
> ******************************************************************************************
> > I have the ant 1.6.3 and ant-contrib 1.0b3-bin on my machine. I have
> copied
> > jar file of ant-contrib in to ant/lib and the initial name of jar file
> was '
> > ant-contrib-1.0b3', I was not sure if this name has to be changed to
> > ant-contrib or antcontrib. But to give it a try, I have tried out that
> also
> > but din't work for me.
> >
> > This is how I am using the "For" task in my build.xml file
> >
> >  <target name="useoffor">
> >   <for param="i" begin="0" step="1" end="5">
> >        <sequential>
> >          <echo>i is @{i}</echo>
> >        </sequential>
> >      </for>
> >   </target>
> >
> > To use "for" task do i need to define any thing else also in my
> > build.xmlfile ? Please let me know where am I going wrong.
> >
> > Thanks a lot in Advance,
> > - Dharmesh Vyas
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: [HELP] How to use ant-contrib inside an ant plugin?

Posted by Peter Reilly <pe...@gmail.com>.
Use the antlib:net.sf.antcontrib namespace

<ac:for param="i" begin="0" step="1" end="5" xmns:ac="antlib:net.sf.antcontrib">
      <sequential>
        <echo>i is @{i}</echo>
      </sequential>
 </ac:for>

Also, you should upgrade to ant 1.6.5 as ant1.6.5 fixes
a number of bugs found in ant 1.6.3.

(or ant 1.7.0 when it comes out in a few weeks).

Peter


On 11/24/06, Dharmesh Vyas <dh...@gmail.com> wrote:
> Hello Group,
>
> I am a new member of the group. I am trying to use ant-contrib plugin with
> ant. I have been facing an issue where in it shows that "Could not create
> task or type of type: for."
>
> The full error that I get is:
>
> ******************************************************************************************D:\Projects\Ant-trials\ant-tasks\BuildTestEnv.xml:42:
> Could not create task or t
> ype of type: for.
>
> Ant could not find the task or a class this task relies upon.
>
> This is common and has a number of causes; the usual
> solutions are to read the manual pages then download and
> install needed JAR files, or fix the build file:
>  - You have misspelt 'for'.
>    Fix: check your spelling.
>  - The task needs an external JAR file to execute
>      and this is not found at the right place in the classpath.
>    Fix: check the documentation for dependencies.
>    Fix: declare the task.
>  - The task is an Ant optional task and the JAR file and/or libraries
>      implementing the functionality were not found at the time you
>      yourself built your installation of Ant from the Ant sources.
>    Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
>      task and make sure it contains more than merely a META-INF/MANIFEST.MF.
>
>      If all it contains is the manifest, then rebuild Ant with the needed
>      libraries present in ${ant.home}/lib/optional/ , or alternatively,
>      download a pre-built release version from apache.org
>  - The build file was written for a later version of Ant
>    Fix: upgrade to at least the latest release version of Ant
>  - The task is not an Ant core or optional task
>      and needs to be declared using <taskdef>.
>  - You are attempting to use a task defined using
>     <presetdef> or <macrodef> but have spelt wrong or not
>    defined it at the point of use
>
> Remember that for JAR files to be visible to Ant tasks implemented
> in ANT_HOME/lib, the files must be in the same directory or on the
> classpath
>
> Please neither file bug reports on this problem, nor email the
> Ant mailing lists, until all of these causes have been explored,
> as this is not an Ant bug.
> ******************************************************************************************
> I have the ant 1.6.3 and ant-contrib 1.0b3-bin on my machine. I have copied
> jar file of ant-contrib in to ant/lib and the initial name of jar file was '
> ant-contrib-1.0b3', I was not sure if this name has to be changed to
> ant-contrib or antcontrib. But to give it a try, I have tried out that also
> but din't work for me.
>
> This is how I am using the "For" task in my build.xml file
>
>  <target name="useoffor">
>   <for param="i" begin="0" step="1" end="5">
>        <sequential>
>          <echo>i is @{i}</echo>
>        </sequential>
>      </for>
>   </target>
>
> To use "for" task do i need to define any thing else also in my
> build.xmlfile ? Please let me know where am I going wrong.
>
> Thanks a lot in Advance,
> - Dharmesh Vyas
>
>

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