繁体   English   中英

多模块Maven项目中的构建结果不同

[英]Different build results in multi module maven project

我有一个多项目的Maven结构,并带有一个父pom。 父pom仅引用要构建的模块。 这些模块具有其子模块等(这是一个相当大且复杂的结构)。 所有项目均为maven 2项目,并符合maven标准。 所以我有这样的事情

父pom.xml

<groupId>com.test</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>

<modules>
    <module>framework</module> 
    <module>server</module> 
    <module>utils</module> 
</modules>

框架pom.xml

<groupId>com.test</groupId>
<artifactId>framework</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>

<modules>
    <module>gui</module> 
    <module>ear</module> 
    <module>libs</module> 
</modules>

如果我从耳朵所在的子模块运行mvn clean install,则按预期构建。 从框架运行mvn全新安装时,我得到的结果是相同的。 但是,当我从顶层运行它时,我的耳朵会包含我不想拥有的其他库(我的耳朵pom.xml中已排除了它们)。 有任何想法吗?

编辑:我以一种经典的方式排除了我的耳朵pom中不需要的lib

<dependency>
    <groupId>ear.dependency</groupId>
    <artifactId>dep1</artifactId>
    <exclusions>
        <exclusion>
             <groupId>unwanted.lib</groupId>
             <artifactId>lib1</artifactId>
        </exclusion>
    </exclusions>
</dependency>

我还比较了mvn依赖项:顶级pom和框架pom中的树,对于耳朵部分,它们是相同的

尝试从根目录和framework文件夹中运行mvn help:effective-pom -pl :ear 比较两个输出。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM