mvn deploy to AWS (ssh via distributionManagement)
- by Dexter
I am working on deploying the WAR file to AWS using Maven. I am planning to use 'mvn deploy' for the same which would ssh the war file to AWS.
I am following http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ssh-external.html.
This is my POM file
<project>
...
<distributionManagement>
<repository>
<id>ssh-aws</id>
<url>scpexe://<ec2 instance>.compute-1.amazonaws.com</url>
</repository>
</distributionManagement>
<build>
<extensions>
<!-- Enabling the use of FTP -->
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-beta-6</version>
</extension>
</extensions>
</build>
..
</project>
This is my settings.xml
<server>
<id>ssh-aws</id>
<username>aws-user</username>
</server>
The only issue is that I am unable to figure out the url in distributionManagement node of pom.xml.
I am able to ssh in the AWS server by the following.
ssh -i ~/pemfile/pemfile-key.pem aws-user@<ec2 instance>.compute-1.amazonaws.com
But when I run mvn clean deploy, I receive this..
Exit code: 1 - Permission denied (publickey). -> [Help 1]
Thanks in advance.