Project A
--Module B
--pom.xml
--Module C
--pom.xml
pom.xml
I am working with a multimodule project where project A, module B, and Module C all have their own pom files. Module A and Module B reference the ProjectA pom file.
I am using ModuleA as a dependency in moduleB's pom file.
I added few packages in moduleA and performed mvn clean install
It updated my .m2 repository with the latest changes I made.
I then did mvn clean install on moduleB, however the moduleB still doesnt recognize the latest changes in module A.
I tried the following, but dint work for me
Module A and Module B reference the ProjectA pom file
ProjectA
should have packaging "pom" and be an "aggregator" of other modules. Its pom.xml
should look like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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.foo.bar</groupId>
<artifactId>myartifactname</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>ModuleB</module>
<module>ModuleC</module>
</modules>
</project>
ProjectA
should not contain any source files, so it doens't make sense to declare a dependency on it in modules B and C.
However Module's A pom.xml can contain definitions common for all the modules (like plugin configurations, properties, etc.) In this case you can use inheritance in modules B and C. For example modules B and C (but not A) can have a "parent" section where they'll declare ProjectA as a "parent" hence inheriting the aforementioned definitions.
I am using ModuleA as a dependency in moduleB's pom file
Again as I've explained above this doesn't make sense. ProjectA is not a java module, and since it has packaging pom there is no real artifact (read jar) that gets built from this module.