简体   繁体   English

在 Linux 上托管的 Sonatype Nexus 存储库上部署 Maven 工件

[英]Deploy Maven artifacts on Sonatype Nexus repository hosted on Linux

I am new to Sonatype Nexus and Maven and trying examples as given in Maven by Example .我是Sonatype Nexus和 Maven 的新手,并尝试了Maven 中给出的示例 Example I have a problem deploying artifacts generated by Maven to Nexus running on Linux.我在将 Maven 生成的工件部署到在 Linux 上运行的 Nexus 时遇到问题。 If my pom.xml has 'localhost:8081' as the repository, the deployment is a success.如果我的pom.xml有 'localhost:8081' 作为存储库,则部署成功。 If I replace localhost with an IP address (10.193.4.5:8081) deployment fails with 'Access denied' error.如果我用 IP 地址 (10.193.4.5:8081) 替换 localhost,则部署失败并出现“拒绝访问”错误。 Details below.详情如下。

Error:
Downloading: h ttp://10.193.4.5:8081/nexus/content/repositories/snapshots/org/sonatype/mavenbook/simple/parent/0.8-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.sonatype.mavenbook.simple:parent:0.8-SNAPSHOT/maven-metadata.xml from/to testing
(http://10.193.4.5:8081/nexus/content/repositories/snapshots): Access denied to: http://10.193.4.5:8081/nexus/content/repositories/snapshots/org/sonatype/mavenbook/simple/parent/0.8-SNAPSHOT/maven-metadata.xml
org.sonatype.aether.transfer.MetadataTransferException:
Could not transfer metadata org.sonatype.mavenbook.simple:parent:0.8-SNAPSHOT/maven-metadata.xml from/to testing (http://10.193.4.5:8081/nexus/content/repositories/snapshots): Access denied to:
http://10.193.4.5:8081/nexus/content/repositories/snapshots/org/sonatype/mavenbook/simple/parent/0.8-SNAPSHOT/maven-metadata.xml

My configuration details are as follows.我的配置细节如下。

  1. Nexus (nexus-oss-webapp-1.9.1.1) installed on linux_x64 (RHEL5) as "root" user and running as service Nexus (nexus-oss-webapp-1.9.1.1) 作为“root”用户安装在 linux_x64 (RHEL5) 上并作为服务运行
  2. Maven Apache Maven 3.0.3 (r1075438; 2011-02-28 23:01:09+0530) Maven home: /usr/local/apache-maven/apache-maven-3.0.3 Java version: 1.6.0_16, vendor: Sun Microsystems Inc. Java home: /usr/java1.6.0_16/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "2.6.18-8.el5", arch: "amd64", family: "unix" Maven Apache Maven 3.0.3 (r1075438; 2011-02-28 23:01:09+0530) Maven home: /usr/local/apache-maven/apache-maven-3.0.3 Java version: 1.6.0_16, vendor: Sun Microsystems Inc. Java 主页:/usr/java1.6.0_16/jre 默认语言环境:en_US,平台编码:UTF-8 操作系统名称:“linux”,版本:“2.6.18-8.4”,arch:“amd6家庭:“unix”
  3. settings.xml snapshots deployment deployment settings.xml快照部署部署
  4. pom.xml testing Internal Releases http://10.193.4.5:8081/nexus/content/repositories/snapshots</url>--> http://localhost:8081/nexus/content/repositories/snapshots pom.xml testing Internal Releases http://10.193.4.5:8081/nexus/content/repositories/snapshots</url>--> http://localhost:8081/nexus/content/repositories/snapshots

I guess this is related to a permission problem on Linux, and I am not able to debug.我猜这与 Linux 上的权限问题有关,我无法调试。

  1. What should be the ideal user for Nexus to run root or Nexus? Nexus 运行 root 或 Nexus 的理想用户应该是什么?
  2. What should be the group and owner for a Sonatype-work folder? Sonatype-work 文件夹的组和所有者应该是什么?

Your problem is most likely related to networking and not to the Nexus setup.您的问题很可能与网络有关,而不是与 Nexus 设置有关。 Try尝试

nc -vz 10.193.4.5 8081

at the console to see if you can route packets to that address.在控制台查看是否可以将数据包路由到该地址。 To make it work with the IP, you'll probably need to add an /etc/hosts entry.要使其与 IP 一起使用,您可能需要添加 /etc/hosts 条目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM