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 ou
Thank you very much. After two long evenings I found the solution.
I had the latest version of ant and not org.apache.ant which was changed at version 1.6 So latest version is today 1.10.1 and it works very well.
Give it a try with newer versions of JSCH dependencies (1.8.4 for ant-jsch and 0.1.53 for jsch, each with different group ids). It fixed the problem on my side:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>server-copy</id>
<goals>
<goal>run</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<target>
<echo message="Pushing to host..." />
<sshexec host="hostname" username="user" trust="true"
password="pass" failonerror="true"
command="mkdir -p /home/user/test/test"/>
<scp trust="yes"
file="some-file"
todir="user:pass@hostname:/path/to/some-file"
/>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.8.4</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.53</version>
</dependency>
</dependencies>
</plugin>