以下是我的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>
关于gradle - 从ant运行Gradle命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54441578/