zoukankan      html  css  js  c++  java
  • 13.继承

    test范围的依赖不能传递,因此需要统一管理各工程中test范围依赖的版本

    [1]创建父工程(打包方式为pom)

    <groupId>com.company.test</groupId>
    <artifactId>Parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    

    [2]在子工程中引用父工程

    <parent>
    	<groupId>com.company.test</groupId>
    	<artifactId>Parent</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    	<!--填写以当前工程目录为基准的父工程的pom.xml文件的相对路径-->
    	<relativePath>../xx/pom.xml</relativePath>
    </parent>
    

    [3]将子工程中与父工程坐标中相同的内容删除,如删除子工程中的(也可以不删除)

    <groupId>com.company.test</groupId>
    

    [4]在父工程统一管理

    <dependencyManagement>
    	<dependencies>
    		<dependency>
    			<groupId>junit</groupId>
    			<artifactId>junit</artifactId>
    			<version>4.0</version>
    			<scope>test</scope>
    		</dependency>
    	</dependencies>
    </dependencyManagement>
    

    [5]记得在子工程中把版本号<version>4.0</version>删去,否则父工程的版本会被子工程覆盖

  • 相关阅读:
    一条SQL的执行流程
    LinkedList源码解析
    MinorGC前检查
    AbstractList源码分析
    JVM常用命令
    CountDownLatch源码解析
    ReentrantLock源码解析
    HTTPS简单介绍
    工厂方法模式
    观察者模式
  • 原文地址:https://www.cnblogs.com/fatmanhappycode/p/12231220.html
Copyright © 2011-2022 走看看