diff --git a/docs/manual/OptionalTasks/scp.html b/docs/manual/OptionalTasks/scp.html index 3b04c6f6c..c65feb6ee 100644 --- a/docs/manual/OptionalTasks/scp.html +++ b/docs/manual/OptionalTasks/scp.html @@ -20,7 +20,7 @@ remote machine.

in the Ant distribution. See Library Dependencies for more information. This task has been tested with jsch-0.1.2 to -jsch-0.1.9.

+jsch-0.1.14.

Parameters

@@ -34,18 +34,53 @@ jsch-0.1.9.

+ authentication or specify the password attribute. The way remote + path is recognized is whether it contains @ character or not. This + will not work if your localPath contains @ character. + + + + + + + + + + + authentication or specify the password attribute. The way remote + path is recognized is whether it contains @ character or not. This + will not work if your localPath contains @ character. + + + + + + + + + + @@ -92,6 +127,13 @@ jsch-0.1.9.

+ + + + +
The file to copy. This can be a local path or a remote path of the form user[:password]@host:/directory/path. :password can be ommitted if you use key based - authentication or specify the password attribute. Yes, unless a nested <fileset> element is used.
localFileThis is an alternative to the file attribute. But + this must always point to a local file. The reason this was added + was that when you give file attribute it is treated as remote if + it contains @ character. This character can exist also in local + paths. since Ant 1.6.2Alternative to file attribute.
remoteFileThis is an alternative to the file attribute. But + this must always point to a remote file. since Ant 1.6.2Alternative to file attribute.
todir The directory to copy to. This can be a local path or a remote path of the form user[:password]@host:/directory/path. :password can be ommitted if you use key based - authentication or specify the password attribute. Yes
localTodirThis is an alternative to the todir + attribute. But this must always point to a local directory. The + reason this was added was that when you give todir attribute it is + treated as remote if it contains @ character. This character can + exist also in local paths. since Ant 1.6.2Alternative to todir attribute.
remoteTodirThis is an alternative to the todir + attribute. But this must always point to a remote directory. + since Ant 1.6.2Alternative to todir attribute.
port The port to connect to on the remote host. Yes, if you are using key based authentication.
verboseDetermines whether SCP outputs verbosely to the + user. Currently this means outputting dots/stars showing the + progress of a file transfer. since Ant 1.6.2No; defaults to false.

Parameters specified as nested elements

diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java index a30fd3e05..b8f167f9a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java @@ -43,6 +43,7 @@ public class Scp extends SSHBase { private String fromUri; private String toUri; private List fileSets = null; + private boolean isFromRemote, isToRemote; /** * Sets the file to be transferred. This can either be a remote @@ -55,6 +56,7 @@ public class Scp extends SSHBase { */ public void setFile(String aFromUri) { this.fromUri = aFromUri; + this.isFromRemote = isRemoteUri(this.fromUri); } /** @@ -68,9 +70,50 @@ public class Scp extends SSHBase { */ public void setTodir(String aToUri) { this.toUri = aToUri; + this.isToRemote = isRemoteUri(this.toUri); } + /** + * Similiar to {@link #setFile setFile} but explicitly states that + * the file is a local file. This is the only way to specify a + * local file with a @ character. + * @since Ant 1.6.2 + */ + public void setLocalFile(String aFromUri) { + this.fromUri = aFromUri; + this.isFromRemote = false; + } + + /** + * Similiar to {@link #setFile setFile} but explicitly states that + * the file is a remote file. + * @since Ant 1.6.2 + */ + public void setRemoteFile(String aFromUri) { + this.fromUri = aFromUri; + this.isFromRemote = true; + } + + /** + * Similiar to {@link #setTodir setTodir} but explicitly states + * that the directory is a local. This is the only way to specify + * a local directory with a @ character. + * @since Ant 1.6.2 + */ + public void setLocalTodir(String aToUri) { + this.toUri = aToUri; + this.isToRemote = false; + } + /** + * Similiar to {@link #setTodir setTodir} but explicitly states + * that the directory is a remote. + * @since Ant 1.6.2 + */ + public void setRemoteTodir(String aToUri) { + this.toUri = aToUri; + this.isToRemote = true; + } /** * Adds a FileSet tranfer to remote host. NOTE: Either @@ -102,11 +145,6 @@ public class Scp extends SSHBase { + "FileSet is required."); } - boolean isFromRemote = false; - if (fromUri != null) { - isFromRemote = isRemoteUri(fromUri); - } - boolean isToRemote = isRemoteUri(toUri); try { if (isFromRemote && !isToRemote) { download(fromUri, toUri);