• 项目引入jar从私服Nexus 拉去遇到的一个问题


    背景

    项目新增了一个pom,使用外网机器下载包到本地。pom文件如下:

    1. [INFO] BUILD FAILURE
    2. [INFO] ------------------------------------------------------------------------
    3. [INFO] Total time: 0.373 s
    4. [INFO] Finished at: 2022-07-04T13:15:20+08:00
    5. [INFO] Final Memory: 11M/243M
    6. [INFO] ------------------------------------------------------------------------
    7. [ERROR] Plugin com.google.cloud.tools:jib-maven-plugin:1.6.0 or one of its dependencies could not be resolved: Failure to find com.google.cloud.tools:jib-maven-plugin:jar:1.6.0 in http://10.50.10.45:8081/repository/maven-public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
    8. [ERROR]
    9. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    10. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    11. [ERROR]
    12. [ERROR] For more information about the errors and possible solutions, please read the following articles:
    13. [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

     为什么有的pom在public 有的在release 仓库?

    idea从maven-public拉取,而nexus的public下没有但是release下却有,这是什么原因呢?

    1. http://ip:8081/repository/maven-public/com/lichkin/framework/lichkin-framework-excel/2.1.0.RELEASE/lichkin-framework-excel-2.1.0.RELEASE.pom
    2. http://ip:8081/repository/maven-releases/maven/repo/lichkin/framework/lichkin-framework-excel/2.1.0.RELEASE/lichkin-framework-excel-2.1.0.RELEASE.pom

    Nexus安装后默认有三个本地仓库,release、snapshot、3rd party

    • Release: 存放稳定版的jar
    • Snapshot: 存放快照版本
    • 3rd Party: 存放自己上传的第三方jar,比如jdbc驱动

    仓库类型又分为三种

    • hosted: 本地仓库,包括上面的release、snapshot、3rd party
    • proxy: 代理仓库,用代理远程的公共仓库,比如中央仓库、阿里云的仓库等
    • group:仓库组,用来分组hosted和proxy,避免项目中引入多个repository

    我的setting文件如下:

    1. <profile>
    2. <id>nexus</id>
    3. <repositories>
    4. <repository>
    5. <id>nexus</id>
    6. <name>Public Repositories</name>
    7. <url>http://ipip:8081/repository/maven-public/</url>
    8. <releases>
    9. <enabled>true</enabled>
    10. </releases>
    11. </repository>
    12. <repository>
    13. <id>central</id>
    14. <name>Central Repositories</name>
    15. <url>http://ipip:8081/repository/maven-central/</url>
    16. <releases>
    17. <enabled>true</enabled>
    18. </releases>
    19. <snapshots>
    20. <enabled>false</enabled>
    21. </snapshots>
    22. </repository>
    23. <repository>
    24. <id>release</id>
    25. <name>Release Repositories</name>
    26. <url>http://ipip:8081/repository/maven-releases/</url>
    27. <releases>
    28. <enabled>true</enabled>
    29. </releases>
    30. <snapshots>
    31. <enabled>false</enabled>
    32. </snapshots>
    33. </repository>
    34. <repository>
    35. <id>snapshots</id>
    36. <name>Snapshot Repositories</name>
    37. <url>http://ipip:8081/repository/maven-snapshots/</url>
    38. <releases>
    39. <enabled>true</enabled>
    40. </releases>
    41. <snapshots>
    42. <enabled>true</enabled>
    43. </snapshots>
    44. </repository>
    45. </repositories>
    46. <pluginRepositories>
    47. <pluginRepository>
    48. <id>plugins</id>
    49. <name>Plugin Repositories</name>
    50. <url>http://ipip:8081/repository/maven-public/</url>
    51. </pluginRepository>
    52. </pluginRepositories>
    53. </profile>

    搞了一天还是没搞定这个仓库的jar包拉取。

    最后决定从本地的仓库加载,需要加这个参数:

    -DarchetypeCatalog=internal 

    问题暂时解决了,但是nexus的坑还没填上。

    z​​​​Nexus安装和使用 - 爱你爱自己 - 博客园

    关于Nexus你需要掌握的知识点_小饭大人的博客-CSDN博客_nexus原理

  • 相关阅读:
    java的集合
    python+flask计算机毕业设计RTY个人记账管理系统(程序+开题+论文)
    程序员副业之无货源闲鱼
    Lombok注解的简单使用
    whois域名查询工具在线使用
    快速理清Paxos、Zab、Raft协议
    react 配置代理 setupProxy.js导致无法连接localhost
    Yolo v8数据马赛克数据增强代码详解
    【Rust】文件系统
    水中铅超标如何处理?除铅吸附材料
  • 原文地址:https://blog.csdn.net/MyySophia/article/details/125598198