首页 > 解决方案 > 构建输出/摘要中包含一些 maven 项目的版本

问题描述

使用 Maven 3.5.4。

我正在构建一个小型多模块 Maven 项目。构建成功完成并输出:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] sample 0.0.7-SNAPSHOT .................... SUCCESS [  0.703 s]
[INFO] sample-api ............................... SUCCESS [  4.131 s]
[INFO] sample-model 0.0.7-SNAPSHOT ............... SUCCESS [ 10.529 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

现在为什么两个项目在摘要中包含项目的版本?我以前没有见过这种情况,并且假设只有在项目名称中包含版本时才会出现这种情况。例如sample-modelpom.xml 仅包含:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>my.group</groupId>
        <artifactId>sample</artifactId>
        <version>0.0.7-SNAPSHOT</version>
    </parent>
    <artifactId>sample-model</artifactId>

</project>

sample-apipom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>my.group</groupId>
        <artifactId>sample</artifactId>
        <version>0.0.7-SNAPSHOT</version>
    </parent>
    <artifactId>sample-api</artifactId>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

标签: maven

解决方案


reactor 中第一个条目和 reactor 中最后一个条目的输出已在Maven 3.5.3中引入。


推荐阅读