| ------ |
| Deployment of artifacts in an external SSH command |
| ------ |
| Jason van Zyl |
| ------ |
| 12 October 2005 |
| ------ |
| |
| ~~ Licensed to the Apache Software Foundation (ASF) under one |
| ~~ or more contributor license agreements. See the NOTICE file |
| ~~ distributed with this work for additional information |
| ~~ regarding copyright ownership. The ASF licenses this file |
| ~~ to you under the Apache License, Version 2.0 (the |
| ~~ "License"); you may not use this file except in compliance |
| ~~ with the License. You may obtain a copy of the License at |
| ~~ |
| ~~ http://www.apache.org/licenses/LICENSE-2.0 |
| ~~ |
| ~~ Unless required by applicable law or agreed to in writing, |
| ~~ software distributed under the License is distributed on an |
| ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| ~~ KIND, either express or implied. See the License for the |
| ~~ specific language governing permissions and limitations |
| ~~ under the License. |
| |
| ~~ NOTE: For help with the syntax of this file, see: |
| ~~ http://maven.apache.org/doxia/references/apt-format.html |
| |
| Deployment of artifacts in an external SSH command |
| |
| In order to deploy artifacts using SSH you must first specify the use of an SSH server in the |
| <<distributionManagement>> element of your POM as well as specifying an <<<extension>>> in your |
| <<<build>>> element which will pull in the SSH artifacts required to deploy with SSH: |
| |
| +----+ |
| |
| <project> |
| ... |
| <distributionManagement> |
| <repository> |
| <id>ssh-repository</id> |
| <url>scpexe://repository.mycompany.com/repository</url> |
| </repository> |
| </distributionManagement> |
| |
| <build> |
| <extensions> |
| <!-- Enabling the use of SSH --> |
| <extension> |
| <groupId>org.apache.maven.wagon</groupId> |
| <artifactId>wagon-ssh-external</artifactId> |
| <version>1.0-beta-6</version> |
| </extension> |
| </extensions> |
| </build> |
| .. |
| </project> |
| |
| +----+ |
| |
| If you are deploying from Unix or have Cygwin installed you won't need to any additional configuration in your <<<settings.xml>>> |
| file as everything will be taken from the environment. But if you are on Windows and are using something like <<<plink>>> then |
| you will need something like the following: |
| |
| +----+ |
| |
| <settings> |
| ... |
| <servers> |
| <server> |
| <id>ssh-repository</id> |
| <username>your username in the remote system if different from local</username> |
| <privateKey>/path/to/your/private/key</privateKey> <!-- not needed if using pageant --> |
| <configuration> |
| <sshExecutable>plink</sshExecutable> |
| <scpExecutable>pscp</scpExecutable> |
| <sshArgs>other arguments you may need</sshArgs> |
| </configuration> |
| </server> |
| </servers> |
| ... |
| </settings> |
| |
| +----+ |
| |
| You should, of course, make sure that you can login into the specified SSH server by hand before attempting the |
| deployment with Maven. Once you have verified that everything is setup correctly you can now deploy your artifacts |
| using Maven: |
| |
| +----+ |
| mvn deploy |
| +----+ |
| |
| Sometimes you may have permissions problems deploying and if so you can set the file and directory permissions |
| like so: |
| |
| +----+ |
| |
| <settings> |
| ... |
| <servers> |
| <server> |
| <id>ssh-repository</id> |
| <!-- |
| | |
| | Change default file/dir permissions |
| | |
| --> |
| <filePermissions>664</filePermissions> |
| <directoryPermissions>775</directoryPermissions> |
| <configuration> |
| <sshExecutable>plink</sshExecutable> |
| <scpExecutable>pscp</scpExecutable> |
| </configuration> |
| </server> |
| </servers> |
| ... |
| </settings> |
| |
| +----+ |
| |
| <<NOTE:>> If you are using Putty it will expect the private key to be in the <<<PPK>>> format and not the standard |
| format so make sure you use <<<puttygen>>> to convert your openssh format key to <<<PPK>>> format or generate another |
| one. Windows users can find the Putty tools on the |
| {{{http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html}PuTTY Download Page}}. |