The maven project b depends on the maven project an and inherits from the maven project p, so will b inherit p as well?

this is actually wrong, but I still wonder if such inheritance can be transitive
p project pom:

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

  <groupId>com.lcr.maven</groupId>
  <artifactId>p</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>p</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <junit.version>4.11</junit.version>
  </properties>
  
  <dependencyManagement>
      <dependencies>
          <dependency>
              <groupId>junit</groupId>
             <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
          </dependency>
      </dependencies>
  </dependencyManagement>
</project>

pom: of a project

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

  <groupId>com.lcr.maven</groupId>
  <artifactId>a_module</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>a_module</name>
  <url>http://maven.apache.org</url>
  <parent>
      <groupId>com.lcr.maven</groupId>
       <artifactId>p</artifactId>
      <version>0.0.1-SNAPSHOT</version>
  </parent>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
  </dependencies>
</project>

pom: of b project

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

  <groupId>com.lcr.maven</groupId>
  <artifactId>b_module</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>b_module</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
 
  <dependencies>
      <dependency>
        <groupId>com.lcr.maven</groupId>
        <artifactId>a_module</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
  </dependencies>
</project>
Oct.11,2021

will inherit unless you actively exclude

through the exclude tag.
Menu