I have the following project package structure.
parent
|- module1
|- module2
|- module3
I am able to include module3 as a dependency in both pom.xml files of module1 & module2. This gives me access to all of the dependencies & code from module3.
<dependency>
<groupId>my.group</groupId>
<artifactId>module3</artifactId>
<version>1.0.0</version>
</dependency>
However, when I run maven commands such as dependency:tree
on the pom file of module1 or module2, maven will try to search on certain <servers>
that are listed in my settings.xml file in order to try & download module3 as an artifact. module3 is not deployed to any <server>
at the moment so, the maven command fails with following error
[ERROR] Failed to execute goal on project module1: Could not resolve dependencies for project my.group:module1:jar:1.0.0-SNAPSHOT: Failed to collect dependencies at my.group:module3:jar:1.0.0-SNAPSHOT: Failed to read artifact descriptor for my.group:module3:jar:1.0.0-SNAPSHOT: Could not transfer artifact my.group:module3:jar:1.0.0-SNAPSHOT from/to MyServer (https://example): Access Denied to: .......etc.
Ideally, module3 would not be deployed at all as an artifact but, instead it might simply have <packaging>pom</packaging>
. module3 is just some module that should only be used by module1 & module2. Also, FYI the dependency tree of module3 builds perfectly fine.
Normally, when you run "mvn clean install" in parent project, all modules will be built, Order builds module3 -> module1 and module2. module3 is always built first.
Thanks