1 Reply Latest reply: Sep 13, 2012 4:14 PM by EJP RSS

    Apache ANT execution error - Problem: failed to create task or type if

    836688
      Hi,
      I am new to ANT and I am facing a few issues when executing a build.xml file. I request your help in resolving this issue.

      I have set the environment variables - ANT_HOME, JAVA_HOME, PATH, ANT_ARGS, ANT_OPTS.

      When I execute the build.xml file, below is the output in the console.

      ******************************************************************************************
      Buildfile: C:\projects\ADAS-INTRAV25A\implementation\build_config\build.xml
      [taskdef] Could not load definitions from resource net/sf/antcontrib/antcontrib.properties. It could not be found.
      [get] Getting: <HTTP URL>:8080/build.xml
      [get] To: C:\Documents and Settings\raora\.ant\build.xml
      [get] Not modified - so not downloaded
      [loadfile] C:\BEA1034\oepe_11gR1PS3\plugins\org.apache.ant_1.7.1.v20100518-1145\etc\tiaa.version.txt doesn't exist

      BUILD FAILED
      C:\projects\ADAS-INTRAV25A\implementation\build_config\build.xml:5: The following error occurred while executing this line:
      C:\Documents and Settings\raora\.ant\build.xml:10: 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.


      Total time: 110 milliseconds
      *****************************************************************************

      When I execute the build file "C:\projects\ADAS-INTRAV25A\implementation\build_config\build.xml", it has a logic to import another build file: "C:\Documents and Settings\raora\.ant\build.xml". I personally don't know the reason behind this as it is an existing code base.

      I read in multiple posts online which suggested downloading the antcontrib.jar file and placing it in the ANT lib folder. I verified it and it is already present. So I am not sure how to proceed here. Below is the content of C:\projects\ADAS-INTRAV25A\implementation\build_config\build.xml

      Please let me know if you need more details.

      <?xml version="1.0"?>
      <project name="adas-intra" default="useage" basedir="../.">
           <property name="war.name" value="adasintraweb"/>
           
           <import file="${user.home}/.ant/build.xml"/>
                
           <!-- **************************************************************************
           These properties determine what components will be built for this project.
           You must comment out the property if you do not want the target to perform
           ************************************************************************** -->
           <!-- property name="build.wsdl" value=""/ -->
           <property name="build.jsp" value=""/>
           <!-- property name="build.ejb" value=""/ -->
           <!-- property name="build.jar" value=""/ -->
           <property name="build.war" value=""/>
           <!-- property name="build.ear" value=""/ -->
           <property name="move.configs" value=""/>
           <!-- ************************************************************************** -->
                
           <property name="schema.dir" location="misc/schemas"/>
           
           <target name="pre.compile" depends="xmlbeans" />
           
           <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpathref="app.classpath"/>
           <target name="xmlbeans">
                <macrodef name="xmlbeans.gen">
                     <attribute name="jarname"/>
                     <attribute name="xsdfile"/>
                     <attribute name="xsdconfig"/>
                     <sequential>
                          <uptodate property="xmlbeans.gen.notRequired" targetfile="${lib.dir}/@{jarname}.jar">
                               <srcfiles dir="${schema.dir}" includes="**/@{xsdfile}.xsd,**/@{xsdconfig}.xsdconfig"/>
                          </uptodate>
                          <if>
                               <not>
                                    <isset property="xmlbeans.gen.notRequired"/>
                               </not>
                               <then>
                                    <xmlbean schema="${schema.dir}/@{xsdfile}.xsd"
                                         destFile="${lib.dir}/@{jarname}.jar"
                                         classgendir="${temp.dir}/@{xsdfile}">
                                         <fileset dir="${schema.dir}" includes="**/@{xsdconfig}.xsdconfig"/>
                                    </xmlbean>
                                    <echo message="@{jarname}.jar GENERATED"/>
                               </then>
                               <else>
                                    <var name="xmlbeans.gen.notRequired" unset="true"/>
                                    <echo message="@{jarname}.jar UPTODATE"/>
                               </else>
                          </if>
                     </sequential>
                </macrodef>
                <echo message="xmlbeans"/>
                <xmlbeans.gen jarname="adas-intra-dsv"
                     xsdfile="master"
                     xsdconfig="master"/>
                <xmlbeans.gen jarname="isv-log-work"
                     xsdfile="log-work-1-3"
                     xsdconfig="log-work-1-3"/>
                <xmlbeans.gen jarname="isv-plan-transfer-out"
                     xsdfile="isv-plan-transfer-out-2-1"
                     xsdconfig="isv-plan-transfer-out-2-1"/>
                <xmlbeans.gen jarname="isv-retirement-transition-benefit"
                     xsdfile="retirement-transition-benefit-3-1"
                     xsdconfig="retirement-transition-benefit-3-1"/>
                <xmlbeans.gen jarname="isv-transfer-participant-funds"
                     xsdfile="transfer-participant-funds-3-0"
                     xsdconfig="transfer-participant-funds-3-0"/>
                <xmlbeans.gen jarname="isv-update-message"
                     xsdfile="isv-update-message-1-0"
                     xsdconfig="isv-update-message-1-0"/>
                <xmlbeans.gen jarname="isv-update-participant-header"
                     xsdfile="isv-update-participant-header-1-0"
                     xsdconfig="isv-update-participant-header-1-0"/>
                <xmlbeans.gen jarname="isv-survivor-t966-report"
                     xsdfile="generate-omni-custom-full-page-report-1-0"
                     xsdconfig="generate-omni-custom-full-page-report-1-0"/>
                
           </target>     
                
      </project>