rongself
V2EX  ›  Java

Maven 有没有类似"npm search xxx" "npm install xxx"这样的命令?

  •  
  •   rongself · Feb 28, 2019 · 3995 views
    This topic created in 2636 days ago, the information mentioned may be changed or developed.
    11 replies    2019-03-01 16:05:54 +08:00
    Ahaochan
        1
    Ahaochan  
       Feb 28, 2019   ❤️ 1
    zjp
        2
    zjp  
       Feb 28, 2019
    楼主这么一问发现 Maven 和其他很多包 /依赖管理不一样...习惯都是打开楼上的网站,直接复制粘贴进 POM
    lihongjie0209
        3
    lihongjie0209  
       Feb 28, 2019   ❤️ 1
    没有, 如果有,你用 maven install 在一个多模块的项目中这个依赖会添加到哪里? 还是手动管理方便一点
    yukiww233
        4
    yukiww233  
       Feb 28, 2019   ❤️ 1
    emmm 搜索的话用 idea 的依赖管理还挺方便的
    chendy
        5
    chendy  
       Feb 28, 2019
    @yukiww233 竟然还有这种东西?!🤭
    drelang
        6
    drelang  
       Feb 28, 2019
    idea 里面,在 pom.xml 文件内按 Alt+Insert 可联机搜索依赖并添加。
    rongself
        7
    rongself  
    OP
       Mar 1, 2019
    @zjp 对啊对啊,用惯了 npm composer,觉得好麻烦啊😂
    wc951
        8
    wc951  
       Mar 1, 2019 via Android
    nexus 里有搜索
    rongself
        9
    rongself  
    OP
       Mar 1, 2019
    @yukiww233 @drelang 跟 IDE 耦合度太高了😂
    deming
        10
    deming  
       Mar 1, 2019   ❤️ 2
    使用 maven 就需要转换一下思路,不要想着和 npm 比。
    使用 maven 就是:
    1. 找到需要引入的 组件 的 “坐标”。
    2. 将 “坐标” 信息 复制-粘贴到 pom.xml 文件中。
    3. ide 会自动感知 pom.xml 变化并下载依赖。( ide 不能自动感知的情况下 执行编译(mvn compile)的时候 组件会自动下载)


    所以,在哪里找依赖组件的“坐标”呢?一般公司都有 nexus 私服,搜索一下就 OK。
    如果是开发 springboot 项目,只需要在官方文档中找到,xx-stater 配置就行了。一个依赖配置便可以引入整套的依赖(因为这些 stater 中已经 pei 配置好了相关的依赖传递)。
    rongself
        11
    rongself  
    OP
       Mar 1, 2019
    @deming 干货,学习了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5325 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 05:51 · PVG 13:51 · LAX 22:51 · JFK 01:51
    ♥ Do have faith in what you're doing.