ANT脚本不起作用

时间:2013-06-07 05:46:57

标签: windows ant yui yuidoc

我有一个通过命令行运行yuidoc的ANT脚本,但是当我运行这个脚本时它会给我以下错误:

 [exec] 'yuidoc' is not recognized as an internal or external command,
 [exec] operable program or batch file.

和相同的命令 - > yuidoc -c yuidoc.json。然后我通过cmd提示符运行它。

我的ANT脚本:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="yuidoc">

<property name="appDir" value="" />

<target name="yuidoc">

    <mkdir dir="docs.javascript"/>

    <copy todir="docs.javascript/yuidoc.assets">
        <fileset dir="yuidoc.assets" />
    </copy>

    <exec dir="${appDir}" executable="cmd">
        <arg line="/K yuidoc -c ${appdir}${file.separator}yuidoc.json .">
        </arg>
    </exec>

</target>

2 个答案:

答案 0 :(得分:1)

替换

executable="cmd"

executable="${pathto/yuidoc}/yuidoc.exe"

示例:

executable="${mytooldir}/bin/mytool.exe"

答案 1 :(得分:1)

尝试像这样设置工作目录......

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="yuidoc">
<target name="yuidoc">
<echo>Generating JavaScript Docs...</echo>

<!-- Input JavaScript dir -->
<property name="parser_in" location="${basedir}/build/js" />
<!-- Output dir  -->
<property name="generator_out" location="${basedir}/resources/doc/api" />
<!-- Theme template  -->
<property name="template" location="${basedir}/resources/theme/default" />
<!-- Path YUIDoc  -->
<property name="yui.doc" value="C:\Users\aabanegas\AppData\Roaming\npm" />

<exec dir="${basedir}" executable="${yui.doc}\yuidoc.cmd">      
    <arg value="${parser_in}" />
    <arg value="-o" />
    <arg value="${generator_out}" />        
    <arg value="-t" />
    <arg value="${template}" />
    <!-- No code -->        
    <arg value="-C" />  
</exec>
</target>