This is my parent pom
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.fish56</groupId>
<artifactId>MavenModules</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>dao</module>
</modules>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.6</version>
<scope>import</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
</dependencyManagement>
this is my child module's pom
<parent>
<artifactId>MavenModules</artifactId>
<groupId>com.github.fish56</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dao</artifactId>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
I wish child module can inheritance parent's dependencies, but it failed.
I can not use lombok or junit in my child pom.
And this is my file tree
.
├── dao
│ ├── pom.xml
│ ├── src
│ └── target
├── pom.xml
I think there should a way the make some dependencies to be shard ammon all modules, But I can not find the solution.