maven antrun ssh or scp hides the output
<p>I want to run an ssh &amp; scp commands using antrun in mvn.<br>
the ssh &amp; scp commands runs correctly, and the plugins that declared inthe next phases - run.
but the output of all commands after the ssh/scp - isn't written to any output!</p>

<p>What is the problem?!</p>

<p>here is my pom.xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;group&lt;/groupId&gt;
    &lt;artifactId&gt;artifact&lt;/artifactId&gt;
    &lt;version&gt;0.0.0-1-SNAPSHOT&lt;/version&gt;
    &lt;name&gt;name&lt;/name&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
    &lt;build&gt;
        &lt;plugins&gt;
            &lt;plugin&gt;
                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.6&lt;/version&gt;
                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;id&gt;echoKuku&lt;/id&gt;
                        &lt;phase&gt;validate&lt;/phase&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;run&lt;/goal&gt;
                        &lt;/goals&gt;
                        &lt;configuration&gt;
                            &lt;target&gt;
                                &lt;sshexec verbose="true" output="o.txt" failonerror="false" host="${Ip}" trust="yes"
                                    username="${UserName}" command="echo kuku" keyfile="${Keyfile}" /&gt;
                                &lt;taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec"
                                    classpathref="maven.plugin.classpath" /&gt;
                            &lt;/target&gt;
                        &lt;/configuration&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
                &lt;dependencies&gt;
                    &lt;dependency&gt;
                        &lt;groupId&gt;commons-net&lt;/groupId&gt;
                        &lt;artifactId&gt;commons-net&lt;/artifactId&gt;
                        &lt;version&gt;1.4.1&lt;/version&gt;
                    &lt;/dependency&gt;
                    &lt;dependency&gt;
                        &lt;groupId&gt;ant&lt;/groupId&gt;
                        &lt;artifactId&gt;ant-commons-net&lt;/artifactId&gt;
                        &lt;version&gt;1.6.5&lt;/version&gt;
                    &lt;/dependency&gt;
                    &lt;dependency&gt;
                        &lt;groupId&gt;ant&lt;/groupId&gt;
                        &lt;artifactId&gt;ant-jsch&lt;/artifactId&gt;
                        &lt;version&gt;1.6.5&lt;/version&gt;
                    &lt;/dependency&gt;
                    &lt;dependency&gt;
                        &lt;groupId&gt;jsch&lt;/groupId&gt;
                        &lt;artifactId&gt;jsch&lt;/artifactId&gt;
                        &lt;version&gt;0.1.29&lt;/version&gt;
                    &lt;/dependency&gt;
                &lt;/dependencies&gt;
            &lt;/plugin&gt;
            &lt;plugin&gt;
                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;id&gt;download-jsch&lt;/id&gt;
                        &lt;phase&gt;compile&lt;/phase&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;copy&lt;/goal&gt;
                        &lt;/goals&gt;
                        &lt;configuration&gt;
                            &lt;overWriteSnapshots&gt;true&lt;/overWriteSnapshots&gt;
                            &lt;artifactItems&gt;
                                &lt;artifactItem&gt;
                                    &lt;groupId&gt;jsch&lt;/groupId&gt;
                                    &lt;artifactId&gt;jsch&lt;/artifactId&gt;
                                    &lt;version&gt;0.1.29&lt;/version&gt;
                                    &lt;overWrite&gt;true&lt;/overWrite&gt;
                                    &lt;outputDirectory&gt;${project.build.directory}&lt;/outputDirectory&gt;
                                &lt;/artifactItem&gt;
                            &lt;/artifactItems&gt;
                        &lt;/configuration&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
            &lt;/plugin&gt;

        &lt;/plugins&gt;
    &lt;/build&gt;
    &lt;properties&gt;
        &lt;javaVersion&gt;1.7&lt;/javaVersion&gt;
        &lt;Ip&gt;1.2.3.4&lt;/Ip&gt;
        &lt;UserName&gt;root&lt;/UserName&gt;
        &lt;Keyfile&gt;${user.home}/.ssh/id_rsa&lt;/Keyfile&gt;
    &lt;/properties&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;jsch&lt;/groupId&gt;
            &lt;artifactId&gt;jsch&lt;/artifactId&gt;
            &lt;version&gt;0.1.29&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
&lt;/project&gt;
</code></pre>

<p>the file jsch-0.1.29.jar was created in the target dir, but the output is:</p>

<pre><code>C:\Users\azberger\somePath&gt;mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building name 0.0.0-1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact jsch:jsch:jar:0.1.29 has been relocated to com.jcraft:jsch:jar:0.1.29
[INFO]
[INFO] --- maven-antrun-plugin:1.6:run (echoKuku) @ artifact ---
[INFO] Executing tasks

main:
  [sshexec] Connecting to 1.2.3.4:22
kuku

C:\Users\azberger\somePath&gt;
</code></pre>

<p><strong>Update: (16/3/16 8:11 GMT)</strong></p>

<p>scp - works fine.<br>
sshexec with a file script (commandResource="[file]") - works fine.<br>
sshexec with a single command (command="[command]") - causes problem, as mention above.</p>