I want to run an ssh & scp commands using antrun in mvn.
the ssh & 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!
What is the problem?!
here is my pom.xml:
<?xml version="1.0" encoding="utf-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<version>0.0.0-1-SNAPSHOT</version>
<name>name</name>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>echoKuku</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<sshexec verbose="true" output="o.txt" failonerror="false" host="${Ip}" trust="yes"
username="${UserName}" command="echo kuku" keyfile="${Keyfile}" />
<taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec"
classpathref="maven.plugin.classpath" />
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-commons-net</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>jsch</groupId>
<artifactId>jsch</artifactId>
<version>0.1.29</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>download-jsch</id>
<phase>compile</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<overWriteSnapshots>true</overWriteSnapshots>
<artifactItems>
<artifactItem>
<groupId>jsch</groupId>
<artifactId>jsch</artifactId>
<version>0.1.29</version>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<javaVersion>1.7</javaVersion>
<Ip>1.2.3.4</Ip>
<UserName>root</UserName>
<Keyfile>${user.home}/.ssh/id_rsa</Keyfile>
</properties>
<dependencies>
<dependency>
<groupId>jsch</groupId>
<artifactId>jsch</artifactId>
<version>0.1.29</version>
</dependency>
</dependencies>
</project>
the file jsch-0.1.29.jar was created in the target dir, but the output is:
C:\Users\azberger\somePath>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>
Update: (16/3/16 8:11 GMT)
scp - works fine.
sshexec with a file script (commandResource="[file]") - works fine.
sshexec with a single command (command="[command]") - causes problem, as mention above.