在build.xml中使用if-statement给出错误

时间:2014-10-16 07:42:36

标签: if-statement jenkins build.xml

我通过jenkins运行一个项目,但我得到了错误

/var/lib/jenkins/workspace/K2_Learning_Build/build.xml:130: The following error occurred while      
executing this line:

/var/lib/jenkins/workspace/K2_Learning_Build/IgnitorACE/build.xml:251: Element type "if" must be  
followed by either attribute specifications, ">" or "/>".

我在build.xml中使用了if条件,如第251行所示

<if ${INSTITUTE_NAME} == "K2_Learning">
<property name = "https.start" value='android:htps=\"' />
<replaceregexp file="../BuildConfig/src/com/edutor/build/${TYPE}.java"  match="public static     
 final String NAVIGATION_MENU_ITEMS[] = (.*)"  replace="public static final String 
 NAVIGATION_MENU_ITEMS[] = ${MENU_LIST_ITEMS};" />    
</if>
<else>
<echo>INSTITUTE_Name: ${INSTITUTE_NAME}</echo>
</else>

请建议解决方案......

1 个答案:

答案 0 :(得分:0)

据我所知,你不能像这样使用if ...尝试:

<if>
    <contains string="${INSTITUTE_NAME}" substring="K2_Learning" />
    <then>
        ...
    </then>
</if>

另请参阅SF中的规范和示例:ant-contrib if spec