简体   繁体   English

如何通过蚂蚁向詹金斯传递以“-”开头的编解码命令?

[英]How does one pass codeception commands that start with “--” via ant to Jenkins?

Building my first ant build.xml file to have Jenkins run Codeception tests and I'm receiving an error "--" is not permitted within comments 构建我的第一个ant build.xml文件以让Jenkins运行Codeception测试,并且"--" is not permitted within comments出现错误"--" is not permitted within comments

I know from reading elsewhere on stackoverflow that xml doesn't allow this. 我从在stackoverflow上的其他文章中了解到xml不允许这样做。 Cure for 'The string "--" is not permitted within comments.' 解决“注释中不允许使用字符串“-””。 exception? 例外?

The conundrum is that several Codeception commands start with --: --xml, --html, --env, etc. 难题是几个Codeception命令以-开头:--xml,-html,-env等。

 <target name="View" description="test for single aaView page">
        <exec executable="${codecept}" failonerror="true">
            <arg value="run" />
            <arg value="tests/acceptance/aaViewCept.php" />
            <arg value="--xml" />
            <arg value="${basedir}/browser/${browser}/tests/_output/report.xml "/>
            <arg value="--env" />
            <arg value="${browser}" />
        </exec>
    </target>

The kicker is that if I remove failonerror="true" Jenkins runs the test just fine. 更重要的是,如果我删除了failonerror="true"詹金斯就可以进行测试了。 I'm experimenting with putting it in as Jenkins shows a passing build with failing test if I don't. 我正在尝试将其放入,因为Jenkins展示了通过的构建,如果没有通过,则测试失败。

The parts =--" are not valid XML. 部分=--"不是有效的XML。

Use <arg value="--xml"/> and <arg value="--env" /> 使用<arg value="--xml"/><arg value="--env" />

The value attribute of the arg element defines arguments passed to the executable and the -- is part of those arguments. arg元素的value属性定义传递给可执行文件的参数, --是这些参数的一部分。

But if you put a XML comment around the <target> element the XML parser will indeed complain because now the -- are not allowed within the comment. 但是,如果你把一个XML注释周围<target>元素的XML解析器会抱怨确实因为现在的--没有在注释中允许的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM