There is a project (type=pom), which is supposed to be used as a parent for another project.
parent
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>my-firm</groupId>
<artifactId>custom-parent</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<distributionManagement>
<repository>
<id>lib-repo-local</id>
<name>my-releases</name>
<url>http://artifactory.local:8081/artifactory/libs-release-local</url>
</repository>
<snapshotRepository>
<id>lib-repo-snapshots</id>
<name>my-snapshots</name>
<url>http://artifactory.local:8081/artifactory/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
</project>
child
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>my-firm</groupId>
<artifactId>custom-parent</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>child-sample</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>lib-repo-local</id>
<name>my-releases</name>
<url>http://artifactory.local:8081/artifactory/libs-release-local</url>
</repository>
<snapshotRepository>
<id>lib-repo-snapshots</id>
<name>my-snapshots</name>
<url>http://artifactory.local:8081/artifactory/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
</project>
The parent project is deployed to the remote repository - artifact my-firm:custom-parent:1.0.0
is available.
When I run mvn clean
on the child project there's an error
[FATAL] Non-resolvable parent POM for my-firm:child-sample:0.0.1:
Failure to find my-firm:custom-parent:1.0.0 in https://repo.maven.apache.org/maven2
was cached in the local repository, resolution will not be reattempted until
the update interval of central has elapsed or updates are forced
and 'parent.relativePath' points at wrong local POM @ line 7, column 11
All the three points in the error message seem to be unrelated to my intentions.
- Maven does not try to look in the repo described in
distributionManagement
, but complaints about maven.central - Nothing is cached in local repository - all artifacts removed from there before the build.
- The
parent.relativePath
is intentionally absent to have the child project agnostic to the parent project location and let it rely only on the deployed artifact (parent pom).
Please, show how to edit the pom
s to have child and parent as separate projects and let child to depend only on the parent artifact.