Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

unable to get it working

Help
rtmo
2007-05-04
2013-04-24
  • rtmo
    rtmo
    2007-05-04

    hi,
    I have ant 1.6.5 and I downloaded ant-contrib-1.0b3.jar in the ant\lib directory.But still whewnever i run a build.xml with this sample code,I get this error
    Could not create task or type of type: for.
    my build.xml is

    <project name="My Application" default="compile" basedir="." >
    <taskdef resource="net/sf/antcontrib/antcontrib.properties">
    <classpath>
    <pathelement location="anthome/lib/ant-contrib-1.0b3.jar" />
    </classpath>
    </taskdef>
    <echo message="The first five letters of the alphabet are:"/>
    <target name ="test" description ="testing this">
    <for list="a,b" param="letter">
        <echo>Letter @{letter}</echo>
    </for>
    </target>
    </project>

    any help would be greatly appreciated
    I have ant_home enviroment variable and the classapth points to ant\lib\bin and the path variable too.
    pls fgive me inputs as to how to get this wrokign

    thanks

     
    • Zoltan Filyo
      Zoltan Filyo
      2007-05-04

      Try this:

      "build.xml">>>>>>
      <?xml version="1.0" encoding="ISO-8859-1"?>

      <!-- Specify include files that necessary for build. -->

      <!DOCTYPE project [

          <!ENTITY AntContrib SYSTEM "file:AntContrib.xml">

          <!ENTITY DevEnv SYSTEM "file:devenv.xml">

      ]>

      <!-- ====================================================================== -->
      <!-- Test project for antcontrib                                            -->
      <!-- ====================================================================== -->

      <project name="My Application" default="compile" basedir="." >

          <!-- Load properties that specifies usable, installed tools for build. -->

          &DevEnv;

          <!-- Include custom Ant tasks for C++ compilation -->

          &AntContrib;

          <echo message="The first five letters of the alphabet are:"/>
          <target name ="compile" description ="testing this">
              <for list="a,b,c,d,e" param="letter">
                  <sequential>
                          <echo message="Letter @{letter}"/>
                  </sequential>
              </for>
          </target>
      </project>
      <<<<<

      "AntContrib.xml">>>>>
      <?xml version="1.0" encoding="ISO-8859-1"?>

      <!--
          Document   : AntContrib.xml
          Created on : November 22, 2004, 13:28
          Author     : zomen
          Description:
              Task definitions to use ant-contrib tasks.
      -->

      <taskdef resource="net/sf/antcontrib/antlib.xml">
          <classpath>
              <pathelement location="${ant-contrib.jar}"/>
          </classpath>
      </taskdef>
      <<<<<<<<<<<<

      "devenv.xml">>>>>>>>
      <?xml version="1.0" encoding="ISO-8859-1"?>

      <!--
      Properties to set up development environment of the project.
      When your development tools installed in other location then you may
      edit these files or alternatively the "devenv.properties" file.
      -->

      <!-- Include property file to override default properties defined below. -->
      <property file="devenv.properties"/>

      <!-- ANT CONTRIB -->
      <!-- Installation directory of ant-contrib -->
      <property name="ant-contrib.lib.dir"
                location="/home/zomen/src/ant-contrib"/>

      <!-- The library full name of ant-contrib -->
      <property name="ant-contrib.jar"
        location="${ant-contrib.lib.dir}/ant-contrib-1.0b3.jar"/>
      <<<<<<<<<<

      "devenv.properties">>>>>>>>
      # Properties to set up development environment.
      # They override the defaults placed in devenv.xml

      #ant-contrib.lib.dir=
      #etc.etc=
      <<<<<<<<<<<<<<

      Good luck, zomen