V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
rongself
V2EX  ›  Java

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

  •  
  •   rongself · 2019-02-28 16:31:42 +08:00 · 2904 次点击
    这是一个创建于 1876 天前的主题,其中的信息可能已经有所发展或是发生改变。
    11 条回复    2019-03-01 16:05:54 +08:00
    Ahaochan
        1
    Ahaochan  
       2019-02-28 16:58:02 +08:00   ❤️ 1
    zjp
        2
    zjp  
       2019-02-28 17:12:20 +08:00
    楼主这么一问发现 Maven 和其他很多包 /依赖管理不一样...习惯都是打开楼上的网站,直接复制粘贴进 POM
    lihongjie0209
        3
    lihongjie0209  
       2019-02-28 17:17:53 +08:00   ❤️ 1
    没有, 如果有,你用 maven install 在一个多模块的项目中这个依赖会添加到哪里? 还是手动管理方便一点
    yukiww233
        4
    yukiww233  
       2019-02-28 17:18:49 +08:00   ❤️ 1
    emmm 搜索的话用 idea 的依赖管理还挺方便的
    chendy
        5
    chendy  
       2019-02-28 17:21:42 +08:00
    @yukiww233 竟然还有这种东西?!🤭
    drelang
        6
    drelang  
       2019-02-28 21:53:08 +08:00
    idea 里面,在 pom.xml 文件内按 Alt+Insert 可联机搜索依赖并添加。
    rongself
        7
    rongself  
    OP
       2019-03-01 10:28:12 +08:00
    @zjp 对啊对啊,用惯了 npm composer,觉得好麻烦啊😂
    wc951
        8
    wc951  
       2019-03-01 10:29:42 +08:00 via Android
    nexus 里有搜索
    rongself
        9
    rongself  
    OP
       2019-03-01 10:32:22 +08:00
    @yukiww233 @drelang 跟 IDE 耦合度太高了😂
    deming
        10
    deming  
       2019-03-01 14:21:56 +08:00   ❤️ 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
       2019-03-01 16:05:54 +08:00
    @deming 干货,学习了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3235 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:05 · PVG 22:05 · LAX 07:05 · JFK 10:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.