0

I have a parent module, which defines its version as follows:

    <groupId>org.group</groupId>
    <artifactId>parent-id</artifactId>
    <packaging>pom</packaging>
    <version>${library.version}</version>

    <properties>
        <library.version>1.0.0</library.version>
    </properties>

Then I have a sub module, which points to its parent as follows:

    <parent>
        <groupId>org.group</groupId>
        <artifactId>parent-id</artifactId>
        <version>${library.version}</version>
        <relativePath>../../</relativePath>
    </parent>

    <artifactId>child-id</artifactId>
    <packaging>jar</packaging>

And I depend on it in my other projects like so:

    <dependency>
        <groupId>org.group</groupId>
        <artifactId>child-id</artifactId>
        <version>1.0.0</version>
    </dependency>

This results in the following error for me:

Failed to read artifact descriptor for org.group:child-id:1.0.0: Failure to find org.group:parent-id:pom:${library.version}

Can this problem be solved without resorting to mvn versions:set in my multi module project to manage explicit versions in all poms?

/edit: currently solved this problem with a workaround that makes using mvn versions:set a little easier.

Benny Bottema
  • 11,111
  • 10
  • 71
  • 96
  • Does the 1.0.0 version of the parent installed in the local m2? (or in your repository manager) And if it is, version 1.0.0 of the parent has the parent.property.library.version property. – miskender Feb 08 '19 at 20:16
  • @SilverShroud Yes it is there in my local .m2 and the property is there as well. I've updated the question to include the relevant parent pom part. – Benny Bottema Feb 08 '19 at 20:25
  • If you need to define a relative path for a parent different than the default which means giving nothing in the parent definition this is an indication that you should change your folder structure according those relationships.... – khmarbaise Feb 08 '19 at 20:26
  • Are you use maven 3.5 or above, there were some problems in prior maven versions for this kind of usages – miskender Feb 08 '19 at 20:44
  • maven 3.5 currently – Benny Bottema Feb 08 '19 at 20:45
  • @SilverShroud What kind of problems are you talking about? – khmarbaise Feb 09 '19 at 10:06
  • @khmarbaise I did not try previous versions, but from the following link I thought previous versions are not suitable for these kind of usages. https://maven.apache.org/maven-ci-friendly.html#Multi_Module_Setup – miskender Feb 09 '19 at 11:09
  • 1
    @SilverShroud If you reference to ci friendly all your given examples in your post will not work cause ci friendly supports only the following three values `revision`, `changelist` and `sha1`.... – khmarbaise Feb 09 '19 at 11:48

0 Answers0