3

Reading the deploy manual id like to specify a different port using

<sshArgs>-P 7221</sshArgs>

in the settings.xml.

But I get a

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy 
  (default-deploy) on project french-toast: Failed to retrieve remote metadata 
  com.foobar:french-toast:1.1.0-SNAPSHOT/maven-metadata.xml: Could not transfer metadata 
  com.foobar:french-toast:1.1.0-SNAPSHOT/maven-metadata.xml from/to french-id 
  (scpexe://root@www.french.com/): Exit code: 1 - ssh: connect to host www.french.com 
  port 22: Connection refused -> [Help 1]

The port 22 is used.

How to change the port? What did I miss?

Grim
  • 1,938
  • 10
  • 56
  • 123
  • Why would you like to change the port? ssh port is port 22 ? Can you do an `ssh ...` manually? – khmarbaise Mar 04 '17 at 09:14
  • Can you share your pom.xml? And your settings.xml? – Adonis Mar 04 '17 at 16:08
  • By the way, why not using the ssh syntax user@host:port ? (or have you already tried it?) – Adonis Mar 04 '17 at 16:36
  • Take a look http://stackoverflow.com/a/1406397/1746118 might help. – Naman Mar 04 '17 at 18:32
  • @kh Wegen der verfluchten hacker. – Grim Mar 05 '17 at 17:59
  • @asettouf Afaik it must be set in the pom but i need it in the settings – Grim Mar 05 '17 at 18:02
  • What is "it" in your comment? – Adonis Mar 06 '17 at 07:57
  • @asettouf "it" means the user@host:port. Complete sentence: *AFAIK the user@host:port must be set in the pom.xml, but i need it in the /home/user/.m2/settings.xml because noone should know the ssh-port of my server.* – Grim Mar 06 '17 at 13:44
  • I see, in that case, you could define in your settings.xml a profile active by default containing the values you want to hide from the pom, and then load the values from the settings.xml inside your pom.xml. Wouldn't it be a viable solution? – Adonis Mar 06 '17 at 13:52

2 Answers2

1

Actually the ssh argument for a port is [-p port] (notice that your are using a capital P), see a man ssh page. Alternatively, you could also use the ssh syntax, i.e. user@host:port

Adonis
  • 4,670
  • 3
  • 37
  • 57
0

*Go to your deploy profile inside pom and in the configuration tag add and specify the port.

<configuration>
               <user>serverusername</user>
                  <password>serverpass@$#</password>
                  <name>project.build.finalName</name>
                    <adminurl>localhost:7003</adminurl>      ---> Here is the answer                   
               <source>youdirectory/finalName.packaging</source>
</configuration>
Antonis
  • 11
  • 5