There is:
Parent pom:
<groupId>practice</groupId>
<artifactId>app</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<modules>
<module>h2db</module>
</modules>
<build>
<pluginManagement>
...
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.185</version>
</dependency>
</dependencies>
Child pom:
<parent>
<artifactId>app</artifactId>
<groupId>practice</groupId>
<version>1.0</version>
</parent>
<artifactId>h2db</artifactId>
<build>
<finalName>h2db</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>h2_server.H2ConsoleServer</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.185</version>
</dependency>
</dependencies>
In this example these is a parent pom that has 2 (or more) dependencies. Child pom has only one dependency that it needs. Is it possible for me to build a jar from this child pom module and include (scope:compile) it's single dependency into it? It builds a jar but does not include h2-dependency in the jar file. I've tried to use maven-assembly-plugin
with jar-with-dependencies
in the child pom but as a result it made a jar with all dependencies from the parent pom.