首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OSGi:如何在maven-bundle-plugin中使用PuTTY scp

OSGi:如何在maven-bundle-plugin中使用PuTTY scp
EN

Stack Overflow用户
提问于 2014-01-21 15:50:52
回答 1查看 1.1K关注 0票数 1

我想将我的maven编译的OSGi包部署到远程OSGi存储库中。我在Windows 7上使用eclipse中的maven-bundle-plugin (2.3.7)。存储库在linux上,可以通过ssh访问。

我在settings.xml中配置了使用plinkpscp (Putty )来完成ssh工作。在<distributionManagement>中,我设置了存储库url,它以scpexe://开头

maven-部署目标运行良好,并将jar文件和metadata.xml上传到存储库。

现在,我还希望生成和上传OBR元数据。因此,我添加了maven-bundle-plugin,<remoteOBR>my-repository</remoteOBR> (与<distributionManagement>中的存储库相同的ID )的配置。

在执行部署时(在成功完成maven部署阶段之后),我将得到错误。

未能在项目引导程序上执行目标org.apache.felix:maven-bundle-plugin:2.3.7:deploy (默认部署):传输失败:退出代码:1- 'scp‘不能识别为内部或外部命令、可操作的程序或批处理文件。 ->帮助1

这意味着maven-bundle插件不使用settings.xml中指定的settings.xml命令,而是使用路径上不可用的"scp“。

如何配置maven-bundle插件以使用PuTTY的pscp?上载OBR数据

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-01-22 16:56:51

我最终找到了一个可行的解决方案:

  1. 不要使用外部ssh工具(PuTTY),而只使用maven内部ssh/scp实现。
  2. 因此,使用车-ssh(不是车-ssh-外部)
  3. 在settings.xml中添加用户名、私钥位置和密码(遗憾的是,不能使用选美,但必须在settings.xml (beuh)中硬编码我的密码)

因此POM看起来像(注意,scp://协议用于url)

代码语言:javascript
复制
<project>
...
  <distributionManagement>
    <repository>
      <id>my-repository</id>
      <url>scp://repo.myserver.com/path/to/repo/</url>
    </repository>
  </distributionManagement>
...
  <build>
    <plugins>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>2.3.7</version>
            <extensions>true</extensions>
            <configuration>
                ...
                <remoteOBR>my-repository</remoteOBR>
            </configuration>
        </plugin>
    </plugins>
    <extensions>
          <extension>
            <groupId>org.apache.maven.wagon</groupId>
             <artifactId>wagon-ssh</artifactId>
             <version>2.5</version>
          </extension>
    </extensions>
  </build>
...

和settings.xml (位于C:\Users\myUsernameOnWindows.m2)

代码语言:javascript
复制
<settings>
  <servers>
    <server>
      <id>my-repository</id>
      <username>myUsernameOnRepo</username>
      <privateKey>C:/path/to/private/key/id_rsa</privateKey>
      <passphrase>myPrivateKeyPassphrase</passphrase>
    </server>
  </servers>
</settings>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21262882

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档