About Me

My photo
Senior Java Engineer, Wavecell Pte Ltd. Singapore

Monday, October 30, 2017

Uploading maven artifacts to a ftp location using SFTP protocol.

Apache Maven Wagon is a set of plugins developed to provides a transport abstraction for handling maven artifacts and repositories. Shown below is the way to use 'wagon-ssh' plugin to upload maven artifacts to a ftp location using the SFTP protocol.

This is quite straight forward and requires few elements to be configured in the pom.xml as follows.

1. Configure repository location of the wagon-git plugin.


        
            synergian-repo
            https://raw.github.com/synergian/wagon-git/releases
        

2. Include the 'wagon-ssh' plugin extension configuration inside the 'build' element.


        
            
                org.apache.maven.wagon
                wagon-ssh
                2.8
            
        

3. Finally we need to include our ftp location using the 'distributionmanagement' element. During the build process artifacts will be uploaded in to following location.


        
            mvn-ftp-server
            sftp://ftp.aravinda-sites.com/my-ftp-repo
        

In order to use SFTP protocol maven settings.xml need to be updated with the ftp server access keys. Here the 'id' defined in the repository should match with the server id.


    
      mvn-ftp-server
      /Users/aravinda/.ssh/id_rsa
      passPhrase
  

Now you can execute,
'
mvn deploy

command to upload the artifacts.

1 comment:


Handling POST request using akka-http in a akka-actor system

Akka-htp is a well known module for providing full server side as well as client side http stack currently supporting Scala and Java langua...