Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 如果发生以下情况,则无法创建任务或类型:_Apache_Ant - Fatal编程技术网

Apache 如果发生以下情况,则无法创建任务或类型:

Apache 如果发生以下情况,则无法创建任务或类型:,apache,ant,Apache,Ant,我得到以下错误 failed to create task or type target Linux操作系统 Ant版本是1.7.1 对于这种类型,我必须在ant库中包含任何jar吗 下面是Build.xml代码的一部分 <target name="wrapFiles"> <fileset dir="${proc_src_path}" id="src.sql"> <exclude name="**/.svn/**"/>

我得到以下错误

      failed to create task or type target
Linux操作系统

Ant版本是1.7.1

对于这种类型,我必须在ant库中包含任何jar吗

下面是Build.xml代码的一部分

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

蚂蚁需要在路径上,然后使用:

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

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

</project>
Linux/Unix=>不要忘记ANT_ARGS行上的引号

  ...
  ANT_ARGS="-lib /usr/local/ant_xtralibs:/usr/local/ant_testlibs"
  export ANT_ARGS
  ...

是“创建任务或类型目标失败”还是“如果创建任务或类型失败”?请更新您的帖子以反映正确的问题。当我使用bat文件在本地系统(Windows OS)中运行代码时,错误为“未能创建任务或类型if”。当我使用sh文件在公共环境(Linux OS)中运行代码时,错误为“未能创建任务或键入目标”。请检查并查看:
@ 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
  ...
  ANT_ARGS="-lib /usr/local/ant_xtralibs:/usr/local/ant_testlibs"
  export ANT_ARGS
  ...