background
directory layout
|
|`parent_project/pom.xml
|
|`child_project/pom.xml
parent pom
<?xml version="1.0" encoding="UTF-8"?>
<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>org.example</groupId>
<artifactId>parent_project</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
</project>
child pom
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>parent_project</artifactId>
<groupId>org.example</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>child_project</artifactId>
<version>${revision}</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
</project>
steps to produce issue
- build parent
mvn clean install -Drevision=1.0-SNAPSHOT -U -f pom.xml
- build child
mvn clean install -Drevision=1.0-SNAPSHOT -U -f pom.xml
- get error
Could not find artifact org.example:parent_project:pom:${revision} in remote-repo (url)
question
I specified the parent version as 1.0-SNAPSHOT in the child's parent block, so why is maven trying to find org.example:parent_project:pom:${revision}?
the ${revision} directory is added to .m2/repository/.../parent_project/ when maven starts looking for parent_project:pom:${revision} while building child_project

answer reworked, checkout the links at the end for documentations
multi module projectandci friendly linkswithrevisionparameter.Example (building parent builds also children, building a child just builds that child):
directory layout
parent pom
child poms (also packaging pom to create a minimal example)
and
links