26Aug/102
Copy Files with SCP Using Maven
You can use Maven AntRun Plugin and Ant SCP task in order to transfer files with SCP:
...
<build>
...
<plugins>
...
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<configuration>
<tasks>
<scp todir="${scp.user}:${scp.password}@${scp.host}:/${scp.dirCopyTo}" trust="true" failonerror="false">
<fileset dir="${bundle.dir}" />
</scp>
</tasks>
</configuration>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.42</version>
</dependency>
</dependencies>
</plugin>
...
Alternatively, you can use Ant sshexec command in order to do additional stuff through SSH, like create or remove folders.
April 11th, 2011 - 22:45
I am looking to SCP files and directories just like you have above. I have setup like you outlined above but it appears the copy never finishes.
I don’t get the “Build Successful message any longer with this task added.
Any suggestions??
April 11th, 2011 - 23:17
What do you mean “copy never finishes”? Can you copy maven output?
Do you see any connection attempts from the server?