是否有 IDE 快捷方式来驱动 Maven Dependency 版本属性?

问题描述

我承认这听起来很疯狂。你不能阅读文档或查找它吗?

所以我正在重构一个遗留项目,我对依赖版本是硬编码而不是属性驱动感到震惊。后者:

  • 提高 pom.xml 的可读性
  • 升级依赖项通常很容易
  • 您可以在父/子子模块中引用属性版本

所以,基本上。下面转

    <dependency>
        <groupId>org.a.c</groupId>
        <artifactId>A1</artifactId>
        <version>1.33</version>
    </dependency>

   <dependency>
        <groupId>org.a.c</groupId>
        <artifactId>A2</artifactId>
        <version>1.34</version>
    </dependency>
   .....

进入

    <properties>
      <A1.version>1.33</A1.version>
      <A2.version>1.34</A2.version>
    </properties>
    
    ...
    <dependency>
        <groupId>org.a.c</groupId>
        <artifactId>A1</artifactId>
        <version>${A1.version}</version>
    </dependency>

   <dependency>
        <groupId>org.a.c</groupId>
        <artifactId>A2</artifactId>
        <version>${A2.version}</version>
    </dependency>

P.S 不要理会正则表达式。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...