Uploading a directory using sftp with Maven

我的梦境 提交于 2019-12-05 02:41:46

问题


How can I upload a directory - Eclipse update site - using sftp with public key authentication in Maven?

For background information: I'm using tycho to build an Eclipse plugin and want to get the update site ( <packaging>eclipse-update-site</packaging>) uploaded.


Asked on the Tycho users list as well.


回答1:


I don't get why you couldn't use mvn deploy to deploy your eclipse-update-site artifact. So, this is my suggestion.

First, update your distributionManagement section:

<!-- Enabling the use of FTP -->
<distributionManagement>
  <repository>
    <id>update-site</id>
    <url>sftp://your/url</url>
  </repository>
</distributionManagement>

Then, add the wagon extension for sftp:

<build>
  <extensions>
    <extension>
      <groupId>org.apache.maven.wagon</groupId>
       <artifactId>wagon-ssh</artifactId>
       <version>1.0-beta-6</version>
    </extension>
  </extensions>
</build>

Finally, add the credentials into your ~/.m2/settings.xml:

<server>
  <id>update-site</id>
  <username>foo</username>
  <password>secret</password>
</server>

And run mvn deploy.




回答2:


Like above's answer but instead of wagon-ssh-external one needs to use wagon-ssh otherwise you'll get an error saying that sftp URLs are not known.



来源:https://stackoverflow.com/questions/1816909/uploading-a-directory-using-sftp-with-maven

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!