u123
u123

Reputation: 16287

Version is included for some maven projects in the build output/summary

Using maven 3.5.4.

I am building a small multi module maven project. The build completes successfully and outputs :

[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

Now why does two of the projects include the version of the project in the summary? I have not seen that before and would assume that would only be the case if I included the version in the project name. E.g. sample-model pom.xml only contains:

<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>

And sample-api pom.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>

Upvotes: 2

Views: 426

Answers (3)

Hizem
Hizem

Reputation: 181

If you have a multi module build where the number is the same for all modules it will be given only on the first line and the last line.

This can be helpful if you have a large number of modules to get the information about the version being built. This meant in the past to scroll up to the last module and look there for the version.

You could check this link for further details Maven 3.5.3 release-notes.

Upvotes: 0

grzeshtoph
grzeshtoph

Reputation: 324

It displays versions for each subsequent submodule if, and only if there is at least one module that breaks up the common versioning within the project. On the other hand it is displaying parent version only (at the parent), if all submodules have the same version, as parent.

For instance, if you had this version in all submodules:

<version>0.0.7-SNAPSHOT</version>

Maven would display only the version once, at the parent project.

In your case you are missing version for api module, thus maven treats it as disruption in common versioning and displays version for all submobules.

And why is it empty for the api? Just because you don't have <version> in there.

Upvotes: 0

khmarbaise
khmarbaise

Reputation: 97409

The output for the first entry in reactor and the last entry in reactor has been introduced in Maven 3.5.3.

Upvotes: 3

Related Questions