| 1 |
------ |
| 2 |
Deployment of artifacts in an external SSH command |
| 3 |
------ |
| 4 |
Jason van Zyl |
| 5 |
------ |
| 6 |
2005-10-12 |
| 7 |
------ |
| 8 |
|
| 9 |
~~ Licensed to the Apache Software Foundation (ASF) under one |
| 10 |
~~ or more contributor license agreements. See the NOTICE file |
| 11 |
~~ distributed with this work for additional information |
| 12 |
~~ regarding copyright ownership. The ASF licenses this file |
| 13 |
~~ to you under the Apache License, Version 2.0 (the |
| 14 |
~~ "License"); you may not use this file except in compliance |
| 15 |
~~ with the License. You may obtain a copy of the License at |
| 16 |
~~ |
| 17 |
~~ http://www.apache.org/licenses/LICENSE-2.0 |
| 18 |
~~ |
| 19 |
~~ Unless required by applicable law or agreed to in writing, |
| 20 |
~~ software distributed under the License is distributed on an |
| 21 |
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 22 |
~~ KIND, either express or implied. See the License for the |
| 23 |
~~ specific language governing permissions and limitations |
| 24 |
~~ under the License. |
| 25 |
|
| 26 |
~~ NOTE: For help with the syntax of this file, see: |
| 27 |
~~ http://maven.apache.org/doxia/references/apt-format.html |
| 28 |
|
| 29 |
Deployment of artifacts in an external SSH command |
| 30 |
|
| 31 |
In order to deploy artifacts using SSH you must first specify the use of an SSH server in the |
| 32 |
<<distributionManagement>> element of your POM as well as specifying an <<<extension>>> in your |
| 33 |
<<<build>>> element which will pull in the SSH artifacts required to deploy with SSH: |
| 34 |
|
| 35 |
+----+ |
| 36 |
|
| 37 |
<project> |
| 38 |
... |
| 39 |
<distributionManagement> |
| 40 |
<repository> |
| 41 |
<id>ssh-repository</id> |
| 42 |
<url>scpexe://repository.mycompany.com/repository</url> |
| 43 |
</repository> |
| 44 |
</distributionManagement> |
| 45 |
|
| 46 |
<build> |
| 47 |
<extensions> |
| 48 |
<!-- Enabling the use of SSH --> |
| 49 |
<extension> |
| 50 |
<groupId>org.apache.maven.wagon</groupId> |
| 51 |
<artifactId>wagon-ssh-external</artifactId> |
| 52 |
<version>1.0-beta-6</version> |
| 53 |
</extension> |
| 54 |
</extensions> |
| 55 |
</build> |
| 56 |
.. |
| 57 |
</project> |
| 58 |
|
| 59 |
+----+ |
| 60 |
|
| 61 |
If you are deploying from Unix or have Cygwin installed you won't need to any additional configuration in your <<<settings.xml>>> |
| 62 |
file as everything will be taken from the environment. But if you are on Windows and are using something like <<<plink>>> then |
| 63 |
you will need something like the following: |
| 64 |
|
| 65 |
+----+ |
| 66 |
|
| 67 |
<settings> |
| 68 |
... |
| 69 |
<servers> |
| 70 |
<server> |
| 71 |
<id>ssh-repository</id> |
| 72 |
<username>your username in the remote system if different from local</username> |
| 73 |
<privateKey>/path/to/your/private/key</privateKey> <!-- not needed if using pageant --> |
| 74 |
<configuration> |
| 75 |
<sshExecutable>plink</sshExecutable> |
| 76 |
<scpExecutable>pscp</scpExecutable> |
| 77 |
<sshArgs>other arguments you may need</sshArgs> |
| 78 |
</configuration> |
| 79 |
</server> |
| 80 |
</servers> |
| 81 |
... |
| 82 |
</settings> |
| 83 |
|
| 84 |
+----+ |
| 85 |
|
| 86 |
You should, of course, make sure that you can login into the specified SSH server by hand before attempting the |
| 87 |
deployment with Maven. Once you have verified that everything is setup correctly you can now deploy your artifacts |
| 88 |
using Maven: |
| 89 |
|
| 90 |
+----+ |
| 91 |
mvn deploy |
| 92 |
+----+ |
| 93 |
|
| 94 |
Sometimes you may have permissions problems deploying and if so you can set the file and directory permissions |
| 95 |
like so: |
| 96 |
|
| 97 |
+----+ |
| 98 |
|
| 99 |
<settings> |
| 100 |
... |
| 101 |
<servers> |
| 102 |
<server> |
| 103 |
<id>ssh-repository</id> |
| 104 |
<!-- |
| 105 |
| |
| 106 |
| Change default file/dir permissions |
| 107 |
| |
| 108 |
--> |
| 109 |
<filePermissions>664</filePermissions> |
| 110 |
<directoryPermissions>775</directoryPermissions> |
| 111 |
<configuration> |
| 112 |
<sshExecutable>plink</sshExecutable> |
| 113 |
<scpExecutable>pscp</scpExecutable> |
| 114 |
</configuration> |
| 115 |
</server> |
| 116 |
</servers> |
| 117 |
... |
| 118 |
</settings> |
| 119 |
|
| 120 |
+----+ |
| 121 |
|
| 122 |
<<NOTE:>> If you are using Putty it will expect the private key to be in the <<<PPK>>> format and not the standard |
| 123 |
format so make sure you use <<<puttygen>>> to convert your openssh format key to <<<PPK>>> format or generate another |
| 124 |
one. Windows users can find the Putty tools on the |
| 125 |
{{{https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html}PuTTY Download Page}}. |