I have three child maven modules.
Parent module pom looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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.abc.proj</groupId>
<artifactId>proj</artifactId>
<version>0.1</version>
<packaging>pom</packaging>
<parent>
<groupId>com.abc.xyz</groupId>
<artifactId>xyz-parent</artifactId>
<version>8.247.0</version>
<relativePath/>
</parent>
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>Application</start-class>
<cassandra.version>3.7.1</cassandra.version>
</properties>
<name>orders</name>
<dependencies>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox.swagger.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox.swagger.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.3.19</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>com.openpojo</groupId>
<artifactId>openpojo</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<artifactId>wiremock</artifactId>
<groupId>com.github.tomakehurst</groupId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<modules>
<module>commons</module>
<module>xyz</module>
</modules>
</project>
Child Module - Common Looks like
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>com.abc.proj</groupId>
<artifactId>proj</artifactId>
<version>0.1</version>
</parent>
<groupId>com.abc.proj</groupId>
<artifactId>commons</artifactId>
<name>commons</name>
</project>
Child Module - xyz Looks like
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.abc.proj</groupId>
<artifactId>proj</artifactId>
<version>0.1</version>
</parent>
<groupId>com.abc.proj</groupId>
<artifactId>xyz</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.abc.proj</groupId>
<artifactId>commons</artifactId>
<version>0.1</version>
</dependency>
</dependencies>
</project>
In xyz Module I added commons dependency.
When I run mvn clean install
in order to builds all the modules. xyz module is failing because it not able to resolve the package of from commons jar.
I tried running mvn dependency:list
I am able to see the common jars in xyz module.
I commented all the classes in xyz and tried to build it once. I was able ti build successfully and when i extracted xyz-01.jar, I found that, it contains commons jar in it. But still not able to resolve the package.
Any idea or help?