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

将dependencies放到dependencyManagement中,如下:        

[html]  view plain copy
  1. <dependencyManagement>  
  2.     <dependencies>  
  3.         <dependency>  
  4.             <groupId>junitgroupId>  
  5.             <artifactId>junitartifactId>  
  6.             <version>4.9version>  
  7.             <scope>testscope>  
  8.         dependency>  
  9.     dependencies>  
  10. dependencyManagement>  
  11.  那么,子模块在使用到junit的时候,只需要声明groupId和artifactId即可,即:

    [html]  view plain copy
    1. <dependencies>  
    2.     <dependency>  
    3.         <groupId>junitgroupId>  
    4.         <artifactId>junitartifactId>  
    5.     dependency>  
    6. dependencies>  

你可能感兴趣的:(maven使用笔记)