javamavenstreambase

Maven child dependency error with parent version


We have the next project structure:

parentPom.xml

So we have a parentPom with inherits to streambaseParentPom and last one inherit to all streambase projects. So, we make attemp to have in parentPom a properti called cerebro.version which define the version for parent. We're getting issues when we have project1 as dependency of other projects, we're getting next error message:

 [ERROR] Failed to execute goal on project eFX-SB7-Pricing: Could not resolve dependencies for project com.santander.fx:eFX-SB7-Pricing:jar:3.14.10.0.4-SNAPSHOT: 
Failed to collect dependencies at com.santander.fx:eFX-SB7-Common:jar:3.14.10.0.4-SNAPSHOT:
 Failed to read artifact descriptor for com.santander.fx:eFX-SB7-Common:jar:3.14.10.0.4-SNAPSHOT:
 Could not transfer artifact com.santander.fx:eFX-SB7-Parent:pom:${cerebro.version} from/to eFX-External-Repository (http://lnx-efxbuild2.ants.ad.anplc.co.uk:8081/artifactory/ext-release-local):
 Illegal character in path at index 109: http://lnx-efxbuild2.ants.ad.anplc.co.uk:8081/artifactory/ext-release-local/com/santander/fx/eFX-SB7-Parent/${cerebro.version}/eFX-SB7-Parent-${cerebro.version}.pom -> [Help 1]

Thanks in advance.


Solution

  • I am afraid it doesn't work like that. It is a bad idea to parameterize the <version> value since even if you managed to deploy it to your remote repo, any project using that artifact later on wouldn't have a clue what ${cerebro.version} should resolve to.

    Remember, Maven works hard to keep your builds reproducible. If the build is dependent on some variable that was known at deploy time, but unknown for dependents, your build will no longer be reproducible.