속성에 환경 변수를 얻는 방법의 Ant documentation에서 예 : 귀하의 경우
<property environment="env"/>
<echo message="Number of Processors = ${env.NUMBER_OF_PROCESSORS}"/>
<echo message="ANT_HOME is set to = ${env.ANT_HOME}"/>
, 당신은 ${env.RELEASE_VER}
을 사용합니다.
Attribute Description Required
property The name of the property to set. Yes
value The value to set the property to. Defaults to "true". No
else The value to set the property to if the condition No
evaluates to false. By default the property will
remain unset. Since Ant 1.6.3
함께 퍼팅 :
그런 다음 조건의 경우, 문서 here이 세 가지 속성이 있다고
내가 이것보다 쉬운 방법이 있습니다 확신
<property environment="env"/>
<condition property="fileTargetName" value="${env.RELEASE_VER}" else="dev">
<isset property="env.RELEASE_VER" />
</condition>
어제는이 질문에 대답 할 수 없었지만, 그래서 내가 연구하도록 강요했습니다. 스택 오버 플로우 만세! –
감사합니다! ant의 이상한 동작 : 환경 매개 변수가 설정되지 않은 경우 $ {env.ANT_HOME}에서 에코를하면 "$ {env.ANT_HOME}"이 인쇄됩니다. 기본 개미 호출은 그것을 설정하지 않습니다. (적어도이 머신에서는 : RH WS 5, bash) –