5

就像之前的 SO-Answer 中推荐的那样,我正在运行 Secureci 的 VmWare 映像作为包含 maven、nexus、hudson、svn 的预配置开发基础架构。

现在我想在我的 Windows XP 机器上配置 maven 以将其工件部署到 nexus。但是当我像这样配置我的 pom.xml 时(取自Deploying Artifacts to Nexus):

<distributionManagement>
    <!-- use the following if you're not using a snapshot version. -->
    <repository>
        <id>nexus</id>
        <name>RepositoryProxy</name>
        <url>scp://192.168.0.197/nexus/content/repositories/releases</url>
    </repository>
    <!-- use the following if you ARE using a snapshot version. -->
    <snapshotRepository>
        <id>nexus</id>
        <name>RepositoryProxy</name>
        <url>scp://192.168.0.197/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
</distributionManagement>

...mvn deploy打印错误消息:

Error deploying artifact: Exit code: 1 - 
    mkdir: cannot create directory `/nexus': Permission denied

settings.xml我这样配置用户名和密码:

<servers>
  <server>
    <id>nexus</id>
    <username>tangens</username>
    <password>********</password>
  </server>
</servers>

问题:我必须使用什么配置来部署到 nexus?


我已经尝试过https代替scp,但是使用这个 maven 时遇到了缺少证书的问题。

我试过http代替scp,但secureci安装了防火墙来阻止对端口80(http)的访问,导致超时。

编辑:

我发现 nexus 将其工件存储在/root/sonatype-work/nexus/storage/snapshots/. 但我不喜欢在我的settings.xml.

编辑:

问:您是否为 Nexus 下的托管存储库启用了部署?

是的,它默认启用。

问: Nexus 是否监听 80 端口?

有一个 apache 在端口 80 上运行。 Server: Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.4.6 mod_ssl/2.2.8 OpenSSL/0.9.8g mod_wsgi/1.3 Python/2.5.2

问:如果防火墙不允许 HTTP,为什么不为来自“主机”IP 的 HTTP 连接添加例外?

因为我假设 SecureCI 配置良好,并且应该有一种方法可以在不调整安装的情况下做到这一点。但也许我在这里太天真了。

4

2 回答 2

12

The error is clear: the user tangens doesn't have the permission to create /nexus on the remote machine. Actually, your scp url is not correct and isn't pointing to the right location as you mentioned it. You'd have to give the user tangens the right permission or to configure sshd to allow root to connect but this is not a good idea.

话虽如此,我认为这不是scpNexus 的方式。如果您使用 部署scp,Nexus 将不会收到部署通知,并且您的工件将不可见。根据将工件部署到 Nexus和第9.4.2 章。更新 POM: Nexus book 的部署配置,必须使用 HTTP PUT 进行部署。换句话说,您的distributionManagement部分应如下所示:

  <distributionManagement>
    ...
    <repository>
      <id>releases</id>
      <name>Internal Releases</name>
      <url>http://localhost:8081/nexus/content/repositories/releases</url>
    </repository>
    ...
  </distributionManagement>

我注意到您说 SecureCI 使用配置为断开端口 80 上的连接的防火墙。但是,由于我自己没有使用 SecureCI,所以我有一些(可能是愚蠢的)问题:

  • 您是否为 Nexus 下的托管存储库启用了部署?
  • Nexus 是否在侦听端口 80?
  • 如果防火墙不允许 HTTP,为什么不为来自“主机”IP 的 HTTP 连接添加例外?

编辑:根据 OP 的回答,我认为使用 HTTPS 可能确实是使用 SecureCI 的“自然”方式。但是,在您可以通过 HTTPS 上传之前,您需要将 SecureCI 的 CA 证书(其证书颁发者的证书)添加到您的 JDK 中。您可以按照这些说明执行此操作。但在更进一步之前,真正的问题是:

  • SecureCI 是否提供 CA 证书(其证书颁发者的证书)?

如果他们不这样做,我不知道如何在不调整防火墙规则的情况下进行部署。

于 2009-10-18T13:58:42.580 回答
1

对不起。刚刚碰到这个问题。

正如其他海报所提到的,有两个选项:将证书提供给 Maven 或打开 HTTP 访问并打开端口 80(默认情况下为安全起见关闭)。

要启用 HTTP 访问,请参阅 SecureCI 中的 /trac/secureci/wiki/HowTo/EnableHttp(在 wiki 上的 HowTo 文档下,如何启用 HTTP 访问?)。

对于证书,公钥和私钥在 /etc/apache2/ssl/ 中。

如果您想替换默认证书,用于安装您自己的文档(可以是自签名的或由公认的 CA 签名)位于 SecureCI wiki 的 /trac/secureci/wiki/HowTo/InstallSslCert(在 HowTo 文档下)在 wiki 上,如何安装 SSL 证书?)。现有证书的位置也在那里注明。

于 2010-02-20T19:48:43.090 回答