maven使用笔记--在父pom中声明过的jar可以被继承,使子项目不用写版本号由父pom控制

来源:互联网 发布:win7网络连接图标不见 编辑:程序博客网 时间:2024/05/18 03:57

将dependencies放到dependencyManagement中,如下:        

[html] view plaincopy在CODE上查看代码片派生到我的代码片
  1. <dependencyManagement>  
  2.     <dependencies>  
  3.         <dependency>  
  4.             <groupId>junit</groupId>  
  5.             <artifactId>junit</artifactId>  
  6.             <version>4.9</version>  
  7.             <scope>test</scope>  
  8.         </dependency>  
  9.     </dependencies>  
  10. </dependencyManagement>  
  11.  那么,子模块在使用到junit的时候,只需要声明groupId和artifactId即可,即:

    [html] view plaincopy在CODE上查看代码片派生到我的代码片
    1. <dependencies>  
    2.     <dependency>  
    3.         <groupId>junit</groupId>  
    4.         <artifactId>junit</artifactId>  
    5.     </dependency>  
    6. </dependencies>  

0 1
原创粉丝点击