On the problem of relying on pom files in the dependency of maven

in the online springcloud tutorials, we often see the following code block under the root pom

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Finchley.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

my understanding is that this is just a declaration, and it will not work if what is not shown in the submodule is declared to be introduced in < dependencies > < / dependencies >. But I found that many sub-modules do not show the introduction, so what is the purpose of this piece?

in addition, several times the submodule shows the introduction, and this is only a pom file, not a jar package, so what"s the use?

Apr.21,2022

controls partially dependent versions and reduces dependent version conflicts


centralized control depends on version
sub-module can directly introduce

without adding version number.

module xxx-parent.pomjar<dependencyManagement> <pluginManagement>pom

<parent>
    <groupId>com.xxx.xxx</groupId>
    <artifactId>xxx-parent</artifactId>
    <version>1.0.0</version>
</parent>

to manage the consistency of all jar packages in the subproject

Menu