• pom文件


    1.父子pom

    如果在一个工程中分多个模块,那么会有父子pom。一般子pom中会有配置,指示其依赖的父pom:

    <parent>
        <groupId>com.xxx</groupId>
        <artifactId>xxx</artifactId>
        <version>1.1.0-SNAPSHOT</version>
    </parent>

    而父pom中会指示对应的子模块。配置如下:

    <modules>
    <module>datacenter-client</module>
    <module>datacenter-web</module>
    <module>biz-datacenter</module>
    <module>datacenter-common</module>
    <module>datacenter-service</module>
    </modules>
      在父pom中会指定所有子模块需要依赖的jar包信息,包括版本信息。子pom中添加依赖的时候,只需要指定groupid、affactid即可。不用版本信息。这样就可以
    统一控制整个工程的jar包版本。可以减少冲突的可能。比如如下配置:
    父pom:
    <dependencies>
    <dependency>
    <groupId>com.lianlianpay.prophet</groupId>
    <artifactId>biz-prophet</artifactId>
    <version>1.0-SNAPSHOT</version>
    </dependency>

    <dependency>
    <groupId>com.lianlianpay.prophet</groupId>
    <artifactId>prophet-common</artifactId>
    <version>1.0-SNAPSHOT</version>
    </dependency>
    </dependencies>

    子pom:
    <dependencies>
    <dependency>
    <groupId>com.lianlianpay.prophet</groupId>
    <artifactId>biz-prophet</artifactId>
    </dependency>

    <dependency>
    <groupId>com.lianlianpay.prophet</groupId>
    <artifactId>prophet-common</artifactId>
    </dependency>
    </dependencies>

    2.多模块打包问题
    在父pom中出现的所有的子模块中。如果在该子模块指定了打包步骤,那么就会对该子模块进行特定打包。一般的mvn package只是打成jar,这是不可执行的。如果想打成可执行的jar包或者
    特定形式的包(比如:自动化部署需要的格式,bin、conf、lib)。那么我们需要在子模块中添加对应格式的打包步骤。那么就会将子模块打成对应的包。


  • 相关阅读:
    windows7通过Dns.GetHostAddresses(Dns.GetHostName())获得ipv6地址转换到ipv4
    题解 P3829 【[SHOI2012]信用卡凸包】
    点积与叉积
    点分治
    珂朵莉树
    NOIP2020模拟赛(二十五)7.26 结题报告
    树连剖分
    NOIP2020模拟赛(拾)解题报告
    题解 P2538 【[SCOI2008]城堡】
    模拟退火
  • 原文地址:https://www.cnblogs.com/cat-and-water/p/5974767.html
Copyright © 2020-2023  润新知