Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

failed to create task or type if

Tags:

apache

ant

I am getting the following error

      failed to create task or type target

Linux OS

Ant Version is 1.7.1

Is there any jar that i must include in the ant library for this type?

Below is my part of my Build.xml code

<target name="wrapFiles">
    <fileset dir="${proc_src_path}" id="src.sql">
        <exclude name="**/.svn/**"/>
    </fileset>  
    <echo message="Initiating Wrap" />
    <echo message="${src.sql}" />
    <pathconvert pathsep="," property="sql.files.present" refid="src.sql"/> 
    <if>
        <equals arg1="${sql.files.present}" arg2="" />
        <then>
            <echo message="No file found. Skipping Wrapping of files." />
        </then>
    <else>
        <echo message="Files found. Proceeding with wrapping of files" />
        <foreach target="wrapFile" param="toWrap">
            <path>  
                <fileset dir="${proc_src_path}" casesensitive="yes">
                    <exclude name="**/*.txt"/>
                    <exclude name="**/*.TXT"/>
                    <exclude name="**/pkg_*_spec.SQL"/>
                    <exclude name="**/pkg_*_spec.sql"/>
                    <exclude name="**/PKG_*_SPEC.sql"/>
                    <exclude name="**/PKG_*_SPEC.SQL"/>
                    <exclude name="**/*.svn/**"/>
                </fileset>          
            </path>  
        </foreach>
    </else>
    </if>

</target>
like image 305
TinsThom Avatar asked Jun 17 '26 22:06

TinsThom


1 Answers

Ant needs antcontrib on path, then use :

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

<ac:if>
...
</ac:if>

</project>

or :

<project>

<taskdef resource="net/sf/antcontrib/antlib.xml"/>

<if>
...
</if>

</project>

When using several ant addons, the installation via namespaces is to be preferred.
To keep your ant core installation clean, don't put antcontrib.jar in %ANT_HOME%\lib, create a folder for ant addon jars instead and use something like that to start your ant scripts :

Windows

@ echo off

set ANT_ARGS=-lib C:\path\to\ant\extralibs
set ANT_HOME=C:\path\to\ant
set ANT_OPTS=-Xmx1024m
set JAVA_HOME=%ProgramFiles(x86)%\JavaSoft\JDK\1.7.0_60
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%

:: DEFAULT
call ant -f %1

:: DEBUG
:call ant -debug -Dfoo=bar -f %1

pause

Linux/Unix => don't forget the quotationmarks on the ANT_ARGS line !

  ...
  ANT_ARGS="-lib /usr/local/ant_xtralibs:/usr/local/ant_testlibs"
  export ANT_ARGS
  ...
like image 133
Rebse Avatar answered Jun 21 '26 18:06

Rebse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!