Ant JUnit 任务:on、yes 和 true 之间有区别吗? [英] Ant JUnit task: Is there a difference between on, yes, and true?

查看:27
本文介绍了Ant JUnit 任务:on、yes 和 true 之间有区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TL;DR:要启用 Ant 功能,onyestrue 之间有区别吗?

TL;DR: To enable an Ant feature, is there a difference between on, yes, and true?

我找不到有关此问题的任何文档.我们有一些似乎随机选择的 Ant 构建脚本:on yestrue 以启用各种 Ant JUnit 功能.

I cannot find any documentation regarding this matter. We have some Ant build scripts that seem to randomly pick between: on yes and true to enable various Ant JUnit features.

示例属性:forkhaltonerror

参考:http://ant.apache.org/manual/Tasks/junit.html

推荐答案

来自 http://ant.apache.org/manual/develop.html:

编写属性设置器的最常见方法是使用 java.lang.String 参数.在这种情况下,Ant 会将文字值(在属性扩展之后)传递给您的任务.但还有更多!如果你的 setter 方法的参数是

The most common way to write an attribute setter is to use a java.lang.String argument. In this case Ant will pass the literal value (after property expansion) to your task. But there is more! If the argument of you setter method is

  • boolean,如果构建文件中指定的值为 true、yes 或 on 和 false 之一,则您的方法将传递值 true.

所以 yesontrue 是一回事.

So yes, on and true are the same thing.

这篇关于Ant JUnit 任务:on、yes 和 true 之间有区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆