2015-04-21 60 views
2

我有兩個螞蟻文件說,分別在Windows和Linux機器上說antFile1.xmlantFile2.xml傳遞值到遠程螞蟻目標

antFile1.xml

<target name="executeOnLinux"> 
     <sshexec 
      host="${remote.host.ip}" 
      username="${remote.user.id}" 
      password="${remote.user.ssh.password}" 
      command="ant -f antFile2.xml 'linuxAntTarget'" 
      trust="true"/> 
</target> 

antFile2.xml

<target name="linuxAntTarget"> 
     <input message="Enter application edition number" addproperty="editionNo"/> 
     <echo message="${editionNo}"/> 
</target> 

當我從我的,它執行從名爲 「executeOnLinux」 antFile1.xml目標連接到linux機器並開始執行「linuxAnt目標「從antFile2.xml文件。但是,一旦達到需要用戶輸入的點,就會一直等待,因爲我無法通過輸入。我的問題是如何將價值傳遞給它?這甚至有可能,或者還有其他更好的方法嗎?

回答

0

由於螞蟻1.9.4中,sshexec任務提供了useSystemIn屬性:

無論當前的標準輸入傳遞給遠程過程,默認爲false

您也可以嘗試input屬性來自同一任務:

從中執行命令的標準輸入的文件。此屬性與inputstring和inputproperty屬性互斥。 當通過commandResource執行多個命令時,將爲每個命令讀取輸入。 因爲Ant 1.8.0

+0

你能提供它的用法示例嗎?我無法複製它。我在sshexec任務中通過了useSystemIn = true,但它並沒有爲我工作。 –

+0

@Prera​​kTiwari你可以發佈你在這個問題上的嘗試嗎? – manouti

+0

我只是在上面給出的「executeOnLinux」中添加屬性「useSystemIn = true」。 –