How to escape @ in Ant SCP task

后端 未结 2 1497
梦如初夏
梦如初夏 2021-01-23 21:25

I would like to ask you for some help. How can I use an scp task when my username contains an @ sign?

I tried to escape the character in many ways but it isn\'t working

相关标签:
2条回答
  • 2021-01-23 21:34

    I use the SCP task in my build.xml and it's form looks like this:

    <scp file="package/ROOT.war" todir="user@example.com:~" trust="true" password="${password}"/>
    

    Looking at the source of the SCP Task at the function parseUri(String uri) (line 370) it appears that the task can support a username with a @ symbol. The restrictions appear to be with paths that have a : or @ in them as seen by this comment:

    // user:password@host:/path notation
    // everything upto the last @ before the last : is considered
    // password. (so if the path contains an @ and a : it will not work)
    

    The code doesn't seem to support this comment (as pointed out by martin clayton). You can also see the error you are referring which is triggered when the password or the keyfile is missing. Maybe the combination of a password in user:password@host:/path notation and a username with an @ is causing problems?

    0 讨论(0)
  • 2021-01-23 21:56

    Present ant version -1.9.4 operating system:-16.04 Ubuntu did not work.

    Changed to 1.9.3 and pointed to /usr/bin/ant ssh was successful observation:

    16.04 and ant 1.9.3 is working
    14.04 ant 1.9.4 is working
    
    0 讨论(0)
提交回复
热议问题