【问题标题】:Custom JAR uploaded to Nexus not resolving from Nexus public group defined in settings.xml上传到 Nexus 的自定义 JAR 未从 settings.xml 中定义的 Nexus 公共组解析
【发布时间】:2019-12-07 17:08:31
【问题描述】:

问题是手动将工件上传到发布存储库,而不是从settings.xml 中定义的 Nexus 组存储库解析。

我尝试将http://localhost:8081/nexus/content/repositories/releases 存储库包含到/nexus/content/groups/public 存储库中,并将组存储库路径定义为settings.xml 中的镜像。

<settings>
  .......
  <mirrors>
    <mirror>
      <id>myteam-nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/nexus/content/groups/public </url>
    </mirror>
  </mirrors>
  .....
</settings>

在 Nexus 中,我有如下自定义 JAR:

<dependency>
  <groupId>com.xxxx.bank</groupId>
  <artifactId>xxxxxcallws</artifactId>
  <version>1.0</version>
</dependency>

pom.xml

<project>
  <dependencies>
    <dependency>
      <groupId>com.xxxx.bank</groupId>
      <artifactId>xxxxxcallws</artifactId>
      <version>1.0</version>
    </dependency>

    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>20160212</version>
    </dependency>
  </dependencies>


  <distributionManagement>
    <repository>
      <id>releases</id>
      <!-- CHANGE HERE by your team nexus server -->
      <url>http://localhost:8081/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
      <id>snapshots</id>
      <!-- CHANGE HERE by your team nexus server -->
      <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
  </distributionManagement>
</project>

当我运行 mvn clean install -U 时出现错误提示:

在 myteam-nexus (http://localhost:8081/nexus/content/groups/public) 中找不到工件 com.xxxx.bank:xxxxxcallws:jar:1.0

注意:此 JAR 已上传到发布存储库 (http://localhost:8081/nexus/content/repositories/releases),我已从 Nexus 管理 UI 将相同的存储库添加到公共组存储库中。

但同样的方式,我将 Maven Central 代理添加到公共组中,并且来自 Central 的依赖项正在拉取,但我上传的 JAR 无法通过公共存储库找到位置。

【问题讨论】:

  • 您是否尝试过在 NXRM 端使缓存无效,以防它(而不是 maven)缓存了一个未找到的对象?你在 UI 中看到了 jar 吗?
  • 是的 jar 我可以在 nexus 中看到,因为它是手动上传的
  • 您是否检查了 NXRM 中的路径与 maven 所说的内容?例如您可以通过网络浏览器或 curl(具有适当权限)下载localhost:8081/nexus/content/groups/public/com.xxxx.bank/… 吗?您必须填写 xxxxx 空白,但希望您能理解我的想法=)

标签: maven maven-2 pom.xml nexus dependency-management


【解决方案1】:

当您手动上传 jar 时,Nexus 会自动添加分类器。 从 nexus 中删除现有的 jar 并再次上传它而不使用分类器。

【讨论】:

    猜你喜欢
    • 2013-05-31
    • 2020-02-03
    • 1970-01-01
    • 2019-09-29
    • 2019-05-31
    • 1970-01-01
    • 2015-07-26
    • 2016-11-30
    • 1970-01-01
    相关资源
    最近更新 更多