I have a web-app which provides an implementation of an API that I have written. So, I have a set of three artifacts: my-webapp (war), my-api (jar) and my-impl (jar). The pom's are straight-forward where: my-impl lists my-api as a dependency, and my-webapp lists my-impl as a dependency. When I run mvn install, I expect my-impl to pull in my-api during packaging into WEB-INF/lib. But it is pulling in only my-impl.
What am I doing wrong here? Or is it not expected to work this way?
Update: If this helps, I keep getting this warning:
[WARN] The POM for mine:my-impl:jar:1.1.0.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
The POM's are as follows:
Packager:
<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>mine</groupId>
<artifactId>my-webapp-packager</artifactId>
<version>${product.version}</version>
<packaging>pom</packaging>
<name>Webapp Packager</name>
<description>Webapp Packager</description>
<modules>
<module>my-webapp</module>
<module>my-api</module>
<module>my-impl</module>
</modules>
</project>
Webapp:
<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>
<parent>
<groupId>mine</groupId>
<artifactId>my-webapp-packager</artifactId>
<version>${product.version}</version>
</parent>
<artifactId>my-webapp</artifactId>
<packaging>war</packaging>
<name>Webapp</name>
<description>Webapp</description>
<dependencies>
<dependency>
<groupId>mine</groupId>
<artifactId>my-impl</artifactId>
<version>${product.version}</version>
</dependency>
</dependencies>
</project>
API:
<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>
<parent>
<groupId>mine</groupId>
<artifactId>my-webapp-packager</artifactId>
<version>${product.version}</version>
</parent>
<artifactId>my-api</artifactId>
<packaging>jar</packaging>
<name>API</name>
<description>API</description>
</project>
Implementation:
<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>
<parent>
<groupId>mine</groupId>
<artifactId>my-webapp-packager</artifactId>
<version>${product.version}</version>
</parent>
<artifactId>my-impl</artifactId>
<packaging>jar</packaging>
<name>Impl</name>
<description>Impl</description>
<dependencies>
<dependency>
<groupId>mine</groupId>
<artifactId>my-api</artifactId>
<version>${product.version}</version>
</dependency>
</dependencies>
</project>