I have a maven project where I need to share 2 levels of common project traits.
One level is project-wide things like remote Maven repo (Artifactory), plugin versions, deps versions.
The other is a complicated mapping of actions to Maven lifecycle, shared for "modules" of a special runtime platform.
The parents are nested:
com.mycompany:projectfoo-parent
^-- parent of:
com.mycompany:projectfoo-module-parent
Each sub-project looks like this:
subprojectA/pom.xml [ROOT] <--parent-- projectfoo-parent
subprojectA/modules/ModuleX/pom.xml [MODULE] <--parent-- projectfoo-module-parent
subprojectA/modules/ModuleY/pom.xml [MODULE] <--parent-- projectfoo-module-parent
All parents are in remote Maven repo (SNAPSHOTS).
Now the issue comes when building in a green field (e.g. CI or with -Dmaven.repo.local=localRepo
):
[FATAL] Non-resolvable parent POM for com.mycompany:projectfoo-moduleX:1.0.0-SNAPSHOT: Could not find artifact com.mycompany:projectfoo--module-parent:pom:1.0.0-SNAPSHOT and 'parent.relativePath' points at no local POM @ line 9, column 13
[FATAL] Non-resolvable parent POM for com.mycompany:projectfoo-moduleY:1.0.0-SNAPSHOT: Could not find artifact com.mycompany:projectfoo--module-parent:pom:1.0.0-SNAPSHOT and 'parent.relativePath' points at no local POM @ line 9, column 13
The -X
shows that Maven doesn't even ask the remote repo for these POMs.
I have tried to place the company's remote Maven repo to the parent, to the module-parent, to settings.xml
, to the module's pom.xml, ... nothing helped.
What should I do to make Maven look for these parent POMs in the remote repo?
Is my setup even valid? Or is that required that a parent of a (Maven) submodule must be the one that contains it in <modules>
? As far as I know, submodules can have arbitrary parent.
A workaround for me could be to bring the parent POMs along and install
them to local repo before running Maven, because once it's there, the build works just fine.
That also implies that the ids and versions are fine. Also, I have checked that the repo IDs and credentials are correct in settings.xml
. Snapshots are enabled for the repo. Maven documentation for that is here.
subProjectA
a multi-module project of its on? – PelionsubprojectA
is a standalone project with it's own Git repo. The parents are in other project and not available as source in the same repo. – Down