Maven clean install并不反映子模块

时间:2015-12-30 08:45:31

标签: maven-3

我创建了一个包含POM的pom.xml,其中包含要构建的所有子模块。

假设pom有4个模块:ABCD。 当我尝试单独运行模块A时,反映了最新的更改。当我尝试使用mvn clean install运行已打包为POM的pom时,我无法在POM的所有模块中使用最新更改来运行它。

2 个答案:

答案 0 :(得分:0)

带有子模块的父pom的示例在这里http://books.sonatype.com/mvnex-book/reference/multimodule-sect-simple-parent.html确保您的孩子/模块没有版本,他们将从父母那里获得。

答案 1 :(得分:0)

1. You have to include your sub-modules in the parent pom.

Parent.pom (say A)

<modules>B</modules>
<modules>C</modules>
<modules>D</modules>

2. In the child pom , you need to specify the parent.

B.pom
    <parent>
        <groupId>groupId</groupId>
        <artifactId>A</artifactId>
        <version>version</version>
    </parent>
C.pom
     <parent>
        <groupId>groupId</groupId>
        <artifactId>A</artifactId>
        <version>version</version>
    </parent>