0
我有一個Ant build.xml,它執行如下檢查,我只是想知道$$表示什麼?
在此先感謝您的幫助。
<equals casesensitive="false" arg1="${subPlan}" arg2="$${subPlan}"/>
我有一個Ant build.xml,它執行如下檢查,我只是想知道$$表示什麼?
在此先感謝您的幫助。
<equals casesensitive="false" arg1="${subPlan}" arg2="$${subPlan}"/>
從螞蟻手冊Properties and PropertyHelpers:
..Ant will expand the text $$ to a single $ and suppress the normal property expansion mechanism..
它通常用於輸出這樣的:
<property name="foo" value="bar"/>
<echo>$${foo} => ${foo}</echo>
輸出:
[echo] ${foo} => bar
在你的情況下,它檢查是否在你的項目中設置了名爲subPlan的屬性,因爲如果它不存在,$ {subPlan}將不會被擴展f.e. :
<project>
<property name="subPlan" value="whatever"/>
<echo>${subPlan}</echo>
</project>
輸出:
[echo] whatever
而:
<project>
<echo>${subPlan}</echo>
</project>
輸出:
[echo] ${subPlan}
它實際上可能爲物業子規劃設置的PropertyValue爲$ {子規劃}:
<property name="subPlan" value="$${subPlan}"/>
但是這沒有意義,所以你的代碼段做一個聯合檢查=>爲地產子規劃,擁有一個有用的價值?可以使用這樣的:
<fail message="Property not set or invalid value !">
<condition>
<equals casesensitive="false" arg1="${subPlan}" arg2="$${subPlan}"/>
</condition>
</fail>
最後的標準方法來檢查屬性是否被使用isset condition設置,F.E. :
<fail message="Property not set !">
<condition>
<not>
<isset property="subPlan"/>
</not>
</condition>
</fail>