运行 Gradle 来自蚂蚁的命令

Running Gradle command from ant

以下是我 build.xml 的片段(运行 成功)

<property name="gradlew" value="./gradlew"/>

<target name="test-functional" description="run functional tests">
    <antcall target="init"/>
    <antcall target="compile"/>
    <echo>Running functional tests...</echo>
    <exec executable="${gradlew}" failonerror="true">
        <arg value="iT"/>
        <!-- <arg value="iT --tests com.mygrailsapp.geb.** -Dgeb.env=firefox -Dgrails.server.port.http=8090"/> -->

    </exec>
</target>

但我只想 运行 我的功能测试(在 geb 目录下)有一些额外的选项,所以我在 <exec> 中的第二个选项中发表评论(运行 很完美从命令行)。 但是从 ant,我得到以下信息;

 [exec] * What went wrong:
 [exec] Task 'iT --tests com.mygrailsapp.geb.**' not found in root project 'mygrailsapp'.

试试这个:

<target name="test-functional" description="run functional tests">
    <antcall target="init"/>
    <antcall target="compile"/>
    <echo>Running functional tests...</echo>
    <exec executable="${gradlew}" failonerror="true">
        <arg value="iT"/>
        <arg value="--tests"/>
        <arg value="com.mygrailsapp.geb.**"/>
        <arg value="-Dgeb.env=firefox"/>
        <arg value="-Dgrails.server.port.http=8090"/>
    </exec>
</target>