Xml ANT检查它是否等于一个值,然后执行任务

Xml ANT检查它是否等于一个值,然后执行任务,xml,shell,xslt,ant,ant-contrib,Xml,Shell,Xslt,Ant,Ant Contrib,我正在努力达到以下要求 我正在ant构建文件中编写一个逻辑来比较我的系统ip地址的值,并在此基础上执行scp任务,在shell脚本中获取本地ip地址,并将其作为ant参数的一部分传递 Shell脚本内容 导出IP地址=ifconfig | grep'inet地址:'| grep-v'127.0.0.1'| cut-d:-f2 | awk'{print$1}' $ant_home/ant-listener$listener-Dlocal.ipaddress=${IP_ADDR}-buildfile

我正在努力达到以下要求

我正在ant构建文件中编写一个逻辑来比较我的系统ip地址的值,并在此基础上执行scp任务,在shell脚本中获取本地ip地址,并将其作为ant参数的一部分传递

Shell脚本内容

导出IP地址=
ifconfig | grep'inet地址:'| grep-v'127.0.0.1'| cut-d:-f2 | awk'{print$1}'

$ant_home/ant-listener$listener-Dlocal.ipaddress=${IP_ADDR}-buildfile BuildHome/build.xml

现在,用户将调用这个shell脚本和一个属性文件

属性文件值

<user-request>

        <prop-value name = "TESTApp">
                <action>install</action>
                <target-location>/apps/properties/messagadapter</target-location>
                <members-info>
                   <ip-address>10.xx.xx.xx</ip-address>
                    <ip-address>10.yy.yy.yy</ip-address>
                </members-info>
                <file-name>test12.xml</file-name>
                <file-name>test23.xml</file-name>
        </prop-value>

</user-request>

安装
/应用程序/属性/消息适配器
10.xx.xx.xx
10.yy.yy.yy
test12.xml
test23.xml
我已经编写了所有必要的XSLT转换,并且能够如下转换用户xml

 <?xml version="1.0" encoding="UTF-8"?><project name="test" default="request" basedir=".">
<target name="process-request">
<ant antfile="build.xml" target="property" dir=".">
<property name="package.name" value="TESTApp"/>
<property name="target" value="install"/>
<property name="target.location" value="/tmp/properties/applications1"/>
<property name="file.list" value="test12.xml,test23.xml"/>
<property name="member.ipaddress" value="10.xx.xx.xx,10.yy.yy.yy"/>
</ant>
</target>
</project>

我的build.xml如下所示,我想检查ipaddress是否等于localipaddress,然后执行必要的操作,但由于某些原因,它从未进入if循环,尽管该值等于本地ip地址,但它始终跳过if条件并转到else

<target name = "deploy" depends="defineAntContribTasks">
     <echo message = "Copying Property files ${file.list} to ${target.location} "/>
     <echo message = " The value of the local ipaddress us .... ${local.ipaddress} "/>
      <echo message = " The value of the member ino ... ${member.ipaddress} "/>
     <for list="${member.ipaddress}" param="ipaddress">
       <sequential>
         <if>
             <equals arg1="@{ipaddress}" arg2="{local.ipaddress}"/>
             <then>
                   <copy todir="${target.location}" overwrite="true">
                       <fileset dir="${input.prop}" includes = "${file.list}"/>
                    </copy>
             </then>
             <else>
                   <echo message = " Inside the else loop ... "/>
                   <echo message = " The value of the ip is ... @{ipaddress}"/>
                   <property name="remoteipaddress" value="@{ipaddress}" />
                   <scp keyfile="/home/fsadmin/.ssh/id_dsa" todir="fsadmin@${remoteipaddress}:${target.location}" passphrase="" trust="true">
                      <fileset dir="${input.prop}" includes="${file.list}"/>
                   </scp>
              </else>
         </if>
       </sequential>
     </for>
  </target>


我不确定这是否失败,因为我们正在执行一个字符串到int的操作或其他原因,我不确定我在哪里丢失了条件,请有人给我指点一下。

看起来您在对等项中丢失了$check:
是的,先生,我应该为这个愚蠢的错误道歉。。。非常感谢你。。。